Saturday 30 September 2017

shell script - Batch converting PNG to JPG in linux


Does anyone know a good way to batch-convert a bunch of PNGs into JPGs in linux? (I'm using Ubuntu).


A png2jpg binary that I could just drop into a shell script would be ideal.



Answer



Your best bet would be to use Imagemagick


I am not an expert in the actual usage, but I know you can pretty much do anything image related with this!


An example is:


convert image.png image.jpg

and it will keep the original as well as creating the converted image. As for batch. I think you need to use the Mogrify tool (from the same command line when in imagemagick). Keep in mind that this overwrites the old images.


The command is:


mogrify -format jpg *.png  

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...