Page 1 of 1
Problem with convert -resize
Posted: 2012-05-04T15:56:57-07:00
by stin
I am very new to IM and having a problem. I'm sure it's simple but I haven't figured it out. I'm trying to convert a whole folder of png files and resize them. This is what I typed in the command line:
convert C:\FullFilePath\imgs\ -resize 50% *.png
I keep getting can't find directry and can't open *.png. The file path is correct.
I tried reading up on it, but with no success.
Re: Problem with convert -resize
Posted: 2012-05-04T19:10:26-07:00
by fmw42
Use mogrify instead of convert. It can handle a whole folder of images, resize them and then write then to the same folder overwriting your original image (bad idea) or to a new folder
see
http://www.imagemagick.org/Usage/basics/#mogrify
Re: Problem with convert -resize
Posted: 2012-05-04T19:25:34-07:00
by stin
Can you give me the syntax? I'm still missing something. I get the following errors:
1) unable to open image ... permission denied @ error/blob.c/OpenBlob/2619
2) no decode delegate for this image format ... @ error/constitute.c/ReadImage/544
(... is just to exclude the file path)
Thanks for the reply.
Re: Problem with convert -resize
Posted: 2012-05-04T19:42:23-07:00
by fmw42
suppose your images are in folder1. create a new directory called folder2
cd to folder 1
mogrify -path /path2/folder2 -format png -resize 50% *
or if you only want to limit it to certain format (so you don't try to convert some odd text file) in your folder1, then
mogrify -path /path2/folder2 -format png -resize 50% *.png *.gif *.jpg
I don't know if your filesystem will be case sensitive, but if it does just add the same in caps
mogrify -path /path2/folder2 -format png -resize 50% *.png *.gif *.jpg *.PNG *.GIF *.JPG
If you are on Windows, the some syntax will be different (apart from \ in place of / for paths). For example % needs to be escaped as %%.
See
http://www.imagemagick.org/Usage/windows/
Re: Problem with convert -resize
Posted: 2012-05-04T20:12:26-07:00
by stin
Got it! Two things I was doing wrong -- I didn't escape the 50%% and I didn't have "format png" -- I don't remember seeing that before...
Thanks very much!
Re: Problem with convert -resize
Posted: 2012-05-04T20:17:23-07:00
by fmw42
the -format png says you want png to be the output format
Re: Problem with convert -resize
Posted: 2012-05-04T20:24:06-07:00
by stin
What does the *png do?
Re: Problem with convert -resize
Posted: 2012-05-04T21:06:22-07:00
by fmw42
it should be *.png
any way, it says look for and process all files that end in .png, but leave any files with other suffixes unprocessed.