This simple tutorial will show you how to convert PNG to JPG in Ubuntu, so that it reduce the memory size and speed up loading image time.
1.) Install the required package by running below command in terminal:
sudo apt-get install imagemagick
2.) Then you can convert an .png image to .jpg format via below command. It takes “ubuntuhandbook.png” in the current directory and creates a JPEG image from it.
convert ubuntuhandbook.png ubuntuhandbook.jpg
You can also specify a compression level for JPEG images.
convert ubuntuhandbook.png -quality 90 ubuntuhandbook.jpg
3.) To convert all PNG files into JPEG files with that same filename but a different suffix. However be warned that if existing file with the same name will be over-written.
mogrify -format jpg *.png
How!!??? I paste in the all command and get this stupid error:
mogrify: unable to open file `boot.png’ @ error/png.c/ReadPNGImage/3922.
I got the same error. Make sure that you are in the same directory as the images that you want to convert.
It works like a charm to me.