Screenshot and Optimize LB 6 Action

Sharing and discussing custom actions for LaunchBar
Post Reply
prenagha
Rank 3
Rank 3
Posts: 87
Joined: Mon Nov 05, 2012 4:10 pm

Screenshot and Optimize LB 6 Action

Post by prenagha » Tue Jun 24, 2014 8:50 pm

Capture a screenshot by initiating selection capture, save to ~/Downloads, optimize using ImageAlpha if present (saving original as well), and send resulting screenshot file back to LaunchBar so it can be used in further action chains.

https://github.com/prenagha/launchbar#screenshot



customized from https://github.com/hlissner/launchbar6-scripts

hlissner
Rank 2
Rank 2
Posts: 42
Joined: Mon Jun 16, 2014 6:06 am
Location: Toronto, ON
Contact:

Re: Screenshot and Optimize LB 6 Action

Post by hlissner » Thu Jun 26, 2014 9:46 am

Great idea! And thanks for the mention.

You've inspired me to do a couple touch ups on mine, the notable differences are:

  • Optimization is invoked only if alt/option is down (I don't always need to optimize my screenshots)
  • The image is put through ImageAlpha and/or ImageOptim (whatever's available)
  • Only one file is saved to ~/Downloads

I've given you a mention in its readme. Cheers!

prenagha
Rank 3
Rank 3
Posts: 87
Joined: Mon Nov 05, 2012 4:10 pm

Re: Screenshot and Optimize LB 6 Action

Post by prenagha » Thu Jun 26, 2014 3:45 pm

For some reason I find the ImageOptim optimization to be very slow, and not as size reducing as ImageAlpha. Of course that is b/c it is not-lossy, but for screenshots ImageOptim seemed to be a better tradeoff. YMMV of course.

hlissner
Rank 2
Rank 2
Posts: 42
Joined: Mon Jun 16, 2014 6:06 am
Location: Toronto, ON
Contact:

Re: Screenshot and Optimize LB 6 Action

Post by hlissner » Thu Jun 26, 2014 5:30 pm

I just tested it myself and you're right, it is. I hadn't realized pngquant could do it nearly instantly! In that case I've made a minor adjustment: ImageAlpha will be used regardless; hold alt for ImageOptim too.

I imagine if anyone needs finer control, they could sendTo Image(Alpha|Optim) themselves.

Anyhow, thanks again!

prenagha
Rank 3
Rank 3
Posts: 87
Joined: Mon Nov 05, 2012 4:10 pm

Re: Screenshot and Optimize LB 6 Action

Post by prenagha » Mon Feb 15, 2016 9:28 pm

Updated to work with latest ImgAlpha and to automatically copy the screenshot to the clipboard as an image

http://prenagha.github.io/launchbar/screenshot.html

Post Reply