Jump to content

Converting image format in clipboard

Recommended Posts

Hello everyone.

I'm making a workflow to convert the copied PNG then paste it as JPG. 

The PNG is mostly just screenshot taken with ⌘⇧⌃4 or copied through the "Copy Image" in the context menu of Chrome/Safari.

My goal is after copied/captured a PNG image, run the workflow in Alfred, then paste it somewhere as JPG, more excatly not pasting it in Finder but in some other software, document editing or Discord ,etc.

I was able to read the clipboard image with {clipboard:0}, but it seems like only getting a text description as in Alfred's clipboard history.

And I also know that I can set clipboard content with "Outputs > Copy to Clipboard", but only the content types of text or rich text are allowed.

If anyone can give me an idea I will be appreciated.

Link to comment
1 hour ago, rayps said:

I was able to read the clipboard image with {clipboard:0}


That only works with text. You can't pass around binary image data in a workflow.


If you want to manipulate images on the clipboard, you'll have to do it via Apple's APIs.

Link to comment
2 hours ago, rayps said:

it's seems like that's how macOS store bitmap data in clipboard.


TIFF's a complicated format. I'm sure it supports JPEG compression, amongst other things.


2 hours ago, rayps said:

there's no JPEG type in NSPasteboard.PasteboardType


You should be able to use the string public.jpeg


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...