Saturday, 30 December 2017

images - Mass rescaling of PNGs


I have a bunch of PNG files that I want to rescale.


Oversimplifying a little, let's say I have files named:



  • apple@2x.png

  • orange@2x.png

  • pear@2x.png


and so on, and I want to make:



  • apple.png

  • orange.png

  • pear.png,


and so on, with the output files all at half the scale of the corresponding input files.


Is there a good tool for that?


I have about 200 input files, so preferably the whole process would be automated.


EDIT: I'm on a mac.



Answer



Yep as mentioned by Ignacio, the convert function from ImageMagick can do so.


If you have access to a Unix based shell, e.g. Linux or Mac terminal, something like this will do:


cd folder-with-the-png-files
for i in *.png; do convert $i -resize 50% ${i/.png/}.resized.png; done

The above command will resize all the images in the folder and save them as xxx.resized.jpg.


Note however, that you may need to install ImageMagick first...


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...