Page 1 of 1

Problems ripping png alpha channel

Posted: 2008-08-13T17:28:14-07:00
by auror
Attempting to get a black and white image of the png alpha channel with this command:

Code: Select all

convert *.png -channel alpha -negate -separate *.png
Produces copies of the original converted images, which I don't want.
I need a solution for this.
Windows, so all solutions must work on it.
I have already tried all of these too:
http://www.imagemagick.org/Usage/channels/#extract

Re: Problems ripping png alpha channel

Posted: 2008-08-13T17:37:36-07:00
by anthony
You can NOT use '*' in a destination image filename!!!!
Only a single filename can be used for the output of convert with and optional %d printf formating for a number when outputting a multiple image sequence as separate files!

That a '*' would expands to the original list of images, only the last of which is used as the save file. As PNG can not save multiple images per file, ALL the images would have been saved as last_file-{number}.png, which is obviously NOT want you want.

See mogify for a command that will process and save images back to the same filename, or to difference format suffix, or different directory.

DANGER DANGER --- mogrify can destroy the original image, caution and testing with a copy of the images is recommended.

Re: Problems ripping png alpha channel

Posted: 2008-08-14T09:46:25-07:00
by auror
Thanks for the tip, it works great!
Here is the new command:

Code: Select all

mogrify -format png -path pathnamehere -channel alpha -negate -separate *.png
One question though, how do I output to a path that contains a space? I have tried putting a / before the space and even replacing it with %20!

Re: Problems ripping png alpha channel

Posted: 2008-08-14T17:18:52-07:00
by anthony
quote the argument. It isn't IM that is giving you the trouble here, but the Wrapping Shell (or DOS) command line environment.