tags:

views:

237

answers:

1

I need to save a bunch (several thousand) of images with imagemagick.

I'm totally new to it, and its documentation seems totally opaque and totally labyrinth. Where's the quickstart guide?

Looking at it, I think I want to use mogrify.

so I cd to my program files directory where I installed imagemagick.

I run mogrify -format png *.png as I see in various examples.

It says:

mogrify: unable to open image `fgimg\': No such file or directory @ blob.c/OpenB
lob/2489.
mogrify: unable to open file `fgimg\' @ png.c/ReadPNGImage/2865.

How do I instruct it to run on all images in the subdirectory \fgimg?

Thanks a lot!

+2  A: 

The problem here is that you're hitting the limit of how much you can put on a command line. You need to split it into chunks that will fit. This should work better:

find -name '*.png' -print0 | xargs -0 -r mogrify -format png

The -print0 and -0 are used to handle spaces in filenames, and the -r means don't run mogrify if there's nothing to do.