Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know there is already such question but it didn't helped me. I have a lot of image files, where I want to change purple RGB(255, 0, 255) to transparent (it is png). Is there any app which could do it quickly? I use Linux, but I am able to use Windows tool.

share|improve this question
    
Which question are you referring to and why didn't it help you? – slhck May 11 '13 at 19:34
    
superuser.com/questions/460937/… – Andy May 11 '13 at 19:42
up vote 1 down vote accepted

Like most questions which involve batch transformations of raster image files, the answer is to be found in the netpbm toolkit. In this case, if your png images don't already have an alpha channel, the simplest solution will be to convert from png to pnm and back again; on the way back, you can specify a transparent colour:

pngtopnm $file | pnmtopng -transparent==rgb:ff/00/ff > new.$file

If your png images do already have an alpha channel (or a different transparent background colour), you'll need to extract the existing alpha channel and then combine it with a new alpha channel consisting of the "purple" pixels. See the -alpha command line option for pngtopnm and pnmtopng. You can use ppmchange to create bitmaps corresponding to a particular colour in an image. You can use ppmcomp or pnmarith to compose two images. (If the images are bitmaps, pnmarith -max and pnmarith -min are bitwise or and and, respectively.)

If the transformation is not available in the netpbm toolkit, it's usually pretty easy to do it with a shell script or a python program; just convert the images to plain format, which is pretty easy to work with.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .