Convert and compress PNG files to JPG in bulk

To compress PNG files to JPG, you can follow steps below:
I. Convert all PNG files to JPG:
Create a script using your favorite Linux text editor and type in the following lines:
for i in $(ls *.png); do
convert $i $i.jpg
done

II. Convert the JPG quality to 50% compression
To compress the JPG files further by 50%, create a script using your favorite Linux text editor:
for i in $(ls *.jpg); do
convert -compress jpeg -quality 50 $i $i.cjpg
done

That’s it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s