Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have 1000 jpg files in which all have a white background. Is is possible to change the white background color to red (for example) of all the files in order not to have to do it one by one ?

I would prefer to use Linux but I can handle Windows.

For example, change the below logo with a white background to have a red background.

enter image description here

share|improve this question
1  
Your question is incomplete. How do the files look like? Can you maybe show us an example? What do you want to do? Do you just want to replace #FFFFFF white with another color? What do you mean by "modify"? Please edit the question to include some more details, otherwise we won't be able to help you. –  slhck Jul 10 '11 at 20:54
    
Edited tags - two OS tags aren't generally very informative on their own. –  new123456 Jul 10 '11 at 22:04
add comment

1 Answer

If there is a way to do, then convert is your friend.

I have used convert for many things, but not specifically for this. Also, whther you actually have a background color in your images is a question -- it may just be a part of the image which has the same color as the background (which is subtle different) -- however even in that case convert may be able to help.

Looking at man convert there is an option for changing background color. There is also a option opaque to change a particular color into the background color.

So playing around with your particular images, and the options you may find what works for your images.

Then the final step would be to write a small shell script to loop though all your images, like this

mkdir converted_img
for img in $(ls orig_image/*) ; do
   convert {insert-options-which-does-the-job} orig_image/$img converted_img/$img
done

and you should be all done

share|improve this answer
    
There is a -background option to convert, just to let you know. –  new123456 Jul 11 '11 at 0:27
    
Just to add to the answer, if you don't have the "convert" tool, you must install the ImageMagick set of applications. –  jmbouffard Jul 11 '11 at 2:01
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.