Jump to content
CarlosNZ

Tiny PNG workflow [Updated to v1.2]

Recommended Posts

5Xz56hO.png
This workflow will take a set of PNG or JPG files and compress them using the online TinyPNG service.

For more info on what it does to the image, see http://tinypng.com/

Usage:

This workflow works as either a File Action or a regular keyword process.

Either:
1) Select the PNG or JPG files you want processed (in Finder or Alfred), then select the "Compress with TinyPNG" File Action in Alfred.
2) Select the PNG or JPG files you want processed in Finder, launch Alfred, then use the “tinypng" keyword.

The processed files will be downloaded to a TinyPNG folder on your Desktop, along with a Report showing the success/failure of each file, and how much it has been compressed by.

The process may take some time, especially if you have selected several large image files, but you will notified on completion. However, if you have Growl/growlnotify installed, you will get a per-file notification as it progresses.

 

A Note on Heavy Usage:

 

The TinyPNG API has a limit of 500 files per month. As you can imagine, once a few people are using the workflow substantially, this doesn't take long to reach. I have provided a default API key built-in so you can use the workflow immediately. However, if you intend to continue using it in any substantial capacity I strongly suggest you visit https://tinypng.com/developers and register for your own API key. You can jump there with the keyword “tinypng_getkey” in Alfred. Once you’ve got your key, save it into the workflow configuration with the keyword  “tinypng_config

 

Download v1.3

 

Cheers,

Carl

 

----

 

28 November 2013 - updated to v1.1

  • Updated to use the new TinyPNG.com API
  • Now works as a regular Alfred keyword (with Finder selection) as well as File Action

 

19 March 2014 - updated to v1.2

  • Now gives better error reporting on failures. (You’ll be able to tell if the monthly limit has been exceeded.)
  • Consolidated processing to a single bash script. The Finder Selection script now just parses the input and sends it to the main script. (Irrelevant to user experience.)
  • User can enter their own API key to prevent reaching the Free account limit when using a shared key.
  • Updated icons (from TinyPNG.com)

 

6 October 2015 - updated to v1.3

  •     Now supports JPG files as well.

 

Edited by CarlosNZ

Share this post


Link to post
nik    0

I really like the look of this, the fact it puts iy in a folder with notifications and reports is super handy.

Only problem is I'm a bit of an Alfred noob and can't get it to work.

 

I download it and double click it to add it to my workflow.

I then select what I want to compress in finder, option spacebar to bring up Alfred but from there I cannot find the action, I type "Compress with TinyPNG" with no luck. Could you let me know if I'm missing something?

 

Thanks

Nik

Share this post


Link to post

I really like the look of this, the fact it puts iy in a folder with notifications and reports is super handy.

Only problem is I'm a bit of an Alfred noob and can't get it to work.

 

I download it and double click it to add it to my workflow.

I then select what I want to compress in finder, option spacebar to bring up Alfred but from there I cannot find the action, I type "Compress with TinyPNG" with no luck. Could you let me know if I'm missing something?

 

Thanks

Nik

Hi Nik,

 

you need to launch Alfred with the "File Selection" hotkey, which you'll find at the bottom of this preference page:

X17fTGQ.png

(I can't remember what the default hotkey is, since I've changed mine).

 

A lot of new users don't seem to aware of the "File Selection" hotkey, I've found, so hopefully that will sort you out.

 

I might add an option in a subsequent update to act on the current Finder selection when launched from Alfred's main window, like I've done with my DeskDrawer workflow.

Edited by CarlosNZ

Share this post


Link to post

It seems thats not working anymore. Returns UPLOAD Falied

I just tried it on a bunch of screenshots and it was working fine. Is it still malfunctioning for you?

Share this post


Link to post

I just tried it on a bunch of screenshots and it was working fine. Is it still malfunctioning for you?

 

It gives me this: http://cl.ly/PW1p

 

And creates a folder called TinyPNG with a txt file named ~Report~.txt

Share this post


Link to post

Hi there,

 

I looooove this workflow. Sadly within the last days it stopped working on my machine. If I try to compress an image I get the message "Shrunk Cannot GET /api/shrinkNAME-OF-FILE"

 

Screenshot attached here:

https://www.evernote.com/shard/s28/sh/5bb8bc01-0467-4761-8d3c-d0cedd70b186/aad144746d51dcaae3ad627d4a5f2c1b

 

Any idea what this is?

 

Cheers!

 

marc

Yes -- they have released a new version of the TinyPNG API.

 

I'll try and get a chance to update the workflow in the next few days. Hopefully by the weekend, so stand by.

 

Glad to hear you're finding it useful.

 

Cheers,

Carl.

Share this post


Link to post

Hey folks, I've updated the workflow to use the new API. Let me know how it's going for you. Hopefully there's no problems.

 

Download here!

 

(The workflow will also now work as a regular keyword, where it will act on the current Finder selection, as well as a File Action.)

 

 

Cool. Thanks. Is it also possible to directly shrink a folder containing PNGs with this API?

Not at this stage. Might be a nice idea for a later version, but it's currently fairly simple to just open the folder and select all the files, isn't it?

 

 

P.S. - There is a limit of 500 PNGs a month for free usage of the API. Depending on how heavily this workflow gets used, I may have to look at getting users to acquire and input their own API keys in future. We'll see how it goes.

Edited by CarlosNZ

Share this post


Link to post

While a lot of people might love the new way of using the workflow, I preferred the old way of using it where it saved the new file with the actual name of the file and named the source png with "-original". Also I liked to be able to use it from Alftred directly without having to select a file on my desktop. That is hand when selecting more than one file, ok, but for a single one I prefer the old way. Is this hard to be integrated or modified? Can I maybe get that to work myself?

 

Thanks for any help.

Share this post


Link to post

P.S. - There is a limit of 500 PNGs a month for free usage of the API. Depending on how heavily this workflow gets used, I may have to look at getting users to acquire and input their own API keys in future. We'll see how it goes.

 

Would this have to do with the 

FILE: /Volumes/trzaktb/Pictures/self/illos/servicebell.png
Problem downloading servicebell_shrink.png
error? It's been working a charm since i updated and suddenly back to this. Let me know how i can help you debug :) this is one of the best workflows for me
 
Edit its not the 500 limit because i tried changing out for a different (new) api.
Edited by trzown

Share this post


Link to post

 

Would this have to do with the 

FILE: /Volumes/trzaktb/Pictures/self/trzown-dec2013/illos/servicebell.png
Problem downloading servicebell_shrink.png
error? It's been working a charm since i updated and suddenly back to this. Let me know how i can help you debug :) this is one of the best workflows for me

 

Hmm … I guessed they changed sth again as I am also getting this error.

Share this post


Link to post

Hey guys, sorry for the lack of communication. I haven't forgotten about this -- just been really busy. I'll have a look at the problem in the next day or so and get back to you. Hopefully it'll be a small fix.

 

Cheers,

Carl.

Share this post


Link to post

Hey guys, I've just tried this again and my version is working fine again.

 

Please make sure you've updated to v1.1 from the link at the top of this thread.

 

Let me know if you're still experiencing problems.

 

Cheers,

Carl.

Share this post


Link to post

Hey guys, FYI -- I think the problem with this workflow failing is due to exceeding my API key's monthly limit of 500 conversions per month. Which also explains why it started working again and then stopped again.

 

Anyway, I'm glad people are getting so much use out of it, but obviously it's not very convenient to have it randomly stop working at a certain point each month. I think I'll update it to make the API key easily editable and then the heavy users (you must know who you are!) can register for their own key and make it work better for everyone.

 

Hopefully I'll do this in the next few days.

 

Cheers,

Carl.

Share this post


Link to post

Hey all,

 

I've updated the workflow to version 1.2 (Download here!) The main feature that will be useful is that it's now easy to acquire and enter your own personal API key, so we should all be able to avoid failures by exceeding the monthly free limit. Just use the keyword tinypng_getkey to get your own key and the keyword tinypng_config to enter your new key.

 

Also, there's better error reporting so you should get a clearer reason if the workflow fails. See first post for further details.

 

Cheers,

Carl.

Edited by CarlosNZ

Share this post


Link to post

Hey all,

 

I've updated the workflow to version 1.2 (Download here!) The main feature that will be useful is that it's now easy to acquire and enter your own personal API key, so we should all be able to avoid failures by exceeding the monthly free limit. Just use the keyword tinypng_getkey to get your own key and the keyword tinypng_config to enter your new key.

 

Also, there's better error reporting so you should get a clearer reason if the workflow fails. See first post for further details.

 

Cheers,

Carl.

 

Hi Carl, I've just started using this and it's fantastic. I've changed it a little so it saves to a different folder but otherwise pretty neat :)

 

Do you know if there's any way to make this kick in upon a certain event? At the moment I have it set to save to $HOME/Desktop/Screenshots/TinyPNG. At the same time I have a setup with Hazel where my screenshots are saved to the same directory, minus the TinyPNG. I'd like to make it so upon a screenshot, it's uploaded, converted at TinyPNG, downloaded to the /TinyPNG subfolder and then delete the original file.

 

Any idea how I could make that happen?

Thanks again for your work :)

Share this post


Link to post

Hi Carl, I've just started using this and it's fantastic. I've changed it a little so it saves to a different folder but otherwise pretty neat :)

 

Do you know if there's any way to make this kick in upon a certain event? At the moment I have it set to save to $HOME/Desktop/Screenshots/TinyPNG. At the same time I have a setup with Hazel where my screenshots are saved to the same directory, minus the TinyPNG. I'd like to make it so upon a screenshot, it's uploaded, converted at TinyPNG, downloaded to the /TinyPNG subfolder and then delete the original file.

 

Any idea how I could make that happen?

Thanks again for your work :)

Hi Matt, glad you like it. :)

 

Personally, I haven't really used Hazel, and I'm not sure how you'd achieve what you want to achieve. I'm sure it could be done if Hazel can trigger shell scripts based on watch folders. Sorry I can't be more specific at this point. Hope you can make sense of the TinyPNG API requests in the tinypng.sh script -- that's the stuff you'll need to run from the Watch Folder trigger.

 

Cheers,

Carl.

Share this post


Link to post

I know this is by no means a brand new workflow, but I've started using it more regularly recently - in particular the file action aspect of it - and I LOVE this workflow. I've got my own API key as I use it fairly heavily, but it's such a huge time-saver. Thanks for creating it :)

 

It's worth mentioning, I've added .jpg to the relevant file types for the file action, as tinypng.com now accepts jpgs as well.

Share this post


Link to post

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
×