How To Convert Png To Jpeg And Vice-Versa? – POFTUT

How To Convert Png To Jpeg And Vice-Versa?

I have a lot of pictures in different formats. But daily used formats are png and jpeg. I want to convert them vice-versa. How can I achieve that?

Install Imagemagick

Imagemagick is a very useful library and tool to work with image files. It is used a lot of popular projects for media-related operations.

Convert Png To Jpg

We will simply convert png extensions to the jpeg format.

Convert Multiple Files From Png To Jpg

We will convert multiple files to the jpg by using ls , xargs commands.

Convert Multiple Files From Jpg To Png

We can also convert the Jpg files into Png files with the following command. As done previously the name will be kept the same and just the format and the extension will be changed.

Convert Using Bash Loop Through Shell

We can use bash loops to loop over image files and run convert command.

Convert Using Bash Loop Through With Bash Script

Some times using bash script is better than running shell. We use following script with file name jpg2png.sh

To make the script executable run following command.

Leave a Reply

Your email address will not be published. Required fields are marked *

Enjoy this blog? Please spread the word :)