How to Convert PNG to JPG on Ubuntu via Command

July 4, 2013 — 1 Comment

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

I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to

One response to How to Convert PNG to JPG on Ubuntu via Command

  1. How!!??? I paste in the all command and get this stupid error:

    mogrify: unable to open file `boot.png’ @ error/png.c/ReadPNGImage/3922.

Leave a Reply


Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>