New User: Convert Transparent PNG to Flattened PNG with white background

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
rwallin
Posts: 1
Joined: 2015-01-14T08:28:09-07:00
Authentication code: 6789

New User: Convert Transparent PNG to Flattened PNG with white background

Post by rwallin »

I have a large number of png files (220k+) across many children folders within a single parent folder that may or may not be flattened. I need to recursively work through these folders and flatten all the transparent PNGs.

Can ImageMagick accommodate this?

Thanks in advance
Rodney
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: New User: Convert Transparent PNG to Flattened PNG with white background

Post by snibgo »

For recursing through directories, use a scripting language.

IM can operate on all files within a directory, but I generally use a script for this also.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: New User: Convert Transparent PNG to Flattened PNG with white background

Post by fmw42 »

You can use mogrify to process all files in one directory. But it does not deal with subdirectories. So as snibgo said you will have to write a script to loop over all the subdirectories. You can then use either mogrify to process all images in each subdirectory or use convert to process each file in each subdirectory one at a time.

see

http://www.imagemagick.org/Usage/basics/
http://www.imagemagick.org/Usage/basics/#mogrify
Post Reply