How to autoprocess screenshots with an optimizer such as ImageOptim and then place immediately back in pasteboard (clipboard) for paste?

Solution 1:

I don't want to take the time now to actually do it, so I'll just point you in the directions I would take. If better answers become available, we can just delete this one :-)

There are two region capturing methods native to the Mac, one saves the file (Desktop by default, but can be anywhere) and one just puts it in your clipboard (some temp file somewhere most likely). You can change the shortcuts, file type and more... some through Preferences, some (file type) through command line in Terminal.

For example, swith the file format with defaults write com.apple.screencapture type jpg...

To process a region snap and get it back into clipboard:

  1. You can do this with Alfred. You may need to save the file instead of just using the clipboard. (AUtomatically Save it to disc, process with compression of your choice (there's even imageoptim Alfred workflow) and put it back into your clipboard with some notification that it's done.) You could start with these Workflows probably and modify them...

    • https://github.com/ginfuru/alfred-screen-capture
    • https://github.com/ramiroaraujo/alfred-screencapture-enhancer-workflow
    • https://github.com/ramiroaraujo/alfred-image-optim-workflow
  2. You can do the same thing with Keyboard Maestro if that's more of your jam.

  3. You may be able to do it with Automator, but I'm not sure about that.