golang-design / clipboard

📋 cross-platform clipboard package that supports accessing text and image in Go (macOS/Linux/Windows/Android/iOS)
https://golang.design/x/clipboard
MIT License
579 stars 64 forks source link

Add support for TIFF images on darwin #47

Open dmbfm opened 1 year ago

dmbfm commented 1 year ago

Since the default image format for the clipboard on macOS is tiff (that is, when you click "Copy Image" on any meny on macOS it will copy the image data in the TIFF format), it seems useful to add support for this in the clipboard_darwin.m file.

It is pretty simple: if the format is not PNG, we try to read TIFF; then, if successful, we convert it to a bitmap and, finally, to PNG. In this manner we return the same PNG data, and the user does not neet do modify his code at all.