What’s the easiest way to convert a .jpg image with white background into .png with alpha channel?

example .jpg:

enter image description here

Ideal .png result:

enter image description here


Command line is quicker. Install Imagemagick.

One file:

convert -transparent white whatever.jpg whatever.png

More files:

Put together a bash script file:

for img in *.jpg; do
convert -transparent white "$filename.jpg" "$filename.png"

Run it and then you will be done. Note that the above will add transparency to everything that is white ‘FFFFFF’ including any pixels of that colour inside your image. “topLeftPixel” can be used instead of “white” for autodecting background colour.

If the white pixels in image problem is a problem then you can do Photoshop batch. Layer mask is better than ‘delete’-clearing the white pixels as you do not actually alter the RGB layers.

Source : Link , Question Author : user1509 , Answer Author : DᴀʀᴛʜVᴀᴅᴇʀ

Leave a Comment