Page 1 of 1

Format of SetClipboardImage()?

Posted: Fri Mar 16, 2012 3:58 pm
by jamirokwai
Hi there,

I tried to copy a new image to the clipboard. Then, I'd like to paste it into Preview.app using "New from clipboard", but the image won't appear.
Hope somebody knows what I am talking about. Which format does the setclipboardimage()-function copy? Why doesn't that work in Preview.app?

I used this:

Code: Select all

If CreateImage(0, 26, 20)
    StartDrawing(ImageOutput(0))
      Box(0, 0, 26, 20, RGB(255, 255, 255))
      Circle(13, 10, 5, RGB(255, 0, 0))
    StopDrawing()
    SetClipboardImage(0)
  EndIf
Thanks in advance :-)

Edit: The format of the clipboard-image is TIFF, says Finder. Can I change this? Would be great to have .png as format for Clipboard-images :-)

Re: Format of SetClipboardImage()?

Posted: Fri Mar 16, 2012 4:36 pm
by IdeasVacuum
I think you would need to save the created image as png in order for it to be png when sent to the clipboard. On Windows, the PB functionality can be replaced with API calls - perhaps that is a possibility on Mac OS too?

Re: Format of SetClipboardImage()?

Posted: Fri Mar 16, 2012 5:07 pm
by jamirokwai
IdeasVacuum wrote:I think you would need to save the created image as png in order for it to be png when sent to the clipboard. On Windows, the PB functionality can be replaced with API calls - perhaps that is a possibility on Mac OS too?
Hi IdeasVacuum,

thanks for your answer. I doubt, that would work.
In my the App I am developing, the image is a JPG. It gets converted to TIFF while copying to clipboard.

Re: Format of SetClipboardImage()?

Posted: Fri Mar 16, 2012 5:17 pm
by IdeasVacuum
...it isn't jpg format in the (PB Help) code you posted? That said, Tiff is a good format but you don't want to convert jpg if it can be avoided. So, starting with Tiff is comparatively a good thing, unless the receiving app cannot accept Tiff of course. I'm surprised the default is Tiff, on Windows the default is bmp.

Re: Format of SetClipboardImage()?

Posted: Fri Mar 16, 2012 5:23 pm
by Shardik
jamirokwai wrote:I tried to copy a new image to the clipboard. Then, I'd like to paste it into Preview.app using "New from clipboard", but the image won't appear.
Perhaps it's a Lion issue. On my Snow Leopard 10.6.8 it's just
working fine. Perhaps some other MacOS X users should test
this too...

Re: Format of SetClipboardImage()?

Posted: Fri Mar 16, 2012 5:46 pm
by Polo
Doesn't work here on Lion.

Re: Format of SetClipboardImage()?

Posted: Fri Mar 16, 2012 10:52 pm
by jamirokwai
Ah, Lion could be the problem. Damn!
Maybe, you are right, Shardik.