How to convert a high number of PNG images to JPG forcing the background color?
I have around 200 hundred PNG small images and I would like to convert all of them into JPG with a black background.
I usually do these kind of batch work with FastStone Image Viewer but there are no option for background color.
Can you suggest me a method and a program that I can use to achieve that result?
Using ImageMagick's command line tools, you could do:
$ composite -compose Dst_Over -tile pattern:GRAY0 image.png image.jpg
- Uses pre-generated pattern (
GRAY0) that is solid black
- Puts the pattern behind (
-compose Dst_Over) your png-file
- Tiles the pattern (
-tile) so it will fill the whole canvas
- Intelligently saves the composite image as JPG (IM recognises the needed conversion from
Now, the aforementioned command can only do one composite image at a time, but you could hook to and loop it with other command line toolsâ€”be it Windows' command line, bash or anything else. (Looking at your profile, you might be most interested in Windows' tools.)
In Photoshop -
Image Processor is what you need:
So this is how it would basically go:
Actionwhere you create a new layer at the bottom and fill it with color.
File > Automate > Batchor
File > Scripts > Image Processorto execute that recorded Action to all of the images.
I got thinking about it and you can also run Actions through
File > Scripts > Image Processor as well and as you can convert the file.. if I remember correctly:
tiff So, it would work better in your case.
So instead of
But, I'll keep that part about saving image inside Action because that allows you to save it in more formats than
Saving image in another format in
Unless cs 5 has way to do this better.. Converting the file format can't be done with batch.
You can however do this:
- As part of the Action where you create new layer and fill it with color, also save the file with the format you want and to the folder you want, then
close the document
ctrl+wand then go to batch and select destination as
noneand run the Batch.