Page 1 of 1

Batch image editin: operating on files with prefix of...

Posted: 2014-10-01T16:32:48-07:00
by leafpressed
Hi, I just posted this post on batch processing: viewtopic.php?f=1&t=26321, and the advise was sound.

Now, before I put the images in their respective folders, I would like to operate on the whole folder, but only on all the images with a selected prefix.

Some of the files would be 18_14+4 and then _{num}.gif I would like to operate on all the images that have the first 7 characters in common, irrespective of the next three numbers.

So if I went: convert *.gif -resize 4500x516 *.gif, this would only be applicable for some of the images, but I don't want to separate them into folders yet to save time by operating on the larger folder first, first all the images, then various catagories, then separate into folders...

Thankyou for your help

Re: Batch image editin: operating on files with prefix of...

Posted: 2014-10-01T16:39:13-07:00
by fmw42
convert *.gif -resize 4500x516 *.gif
This is not proper syntax for convert. I do not think you can have wild cards for both input and output in IM. If you are trying to get one output for each input image. then use mogrify. That is what it is meant to do.

Your question about filtering names is not an IM topic. I do not think IM can do that kind of thing. It is something you can do in your OS directly or by shell or bat scripting.

Re: Batch image editin: operating on files with prefix of...

Posted: 2014-10-01T16:57:43-07:00
by leafpressed
Thankyou for your reply.

As I understand it, convert can work on multiple files, that command just worked, resized all the images in the folder to what I wanted. What is the issue is that mogrify has less commands than it works with, and convert will do multiples with some commands, just not all.

So this way or that way, I welcome further replies on this topic. 8)

Re: Batch image editin: operating on files with prefix of...

Posted: 2014-10-01T17:31:16-07:00
by fmw42
Look carefully at your files and the names.

When I create a folder, called test on my desktop (Mac OSX)
and put 3 files there (copies if logo:).

cd desktop/test
ls
logo1.png
logo2.png
logo3.png

Now do
convert *.png -resize 50% *.png
ls

logo1.png
logo2.png logo3-1.png
logo3.png

logo3-0.png
logo3-2.png
logo3-3.png
logo3-4.png

So I start with 3 images and end with 4 new images that are all from logo3.png

If you are on Window, perhaps your OS works different from unix.

Re: Batch image editin: operating on files with prefix of...

Posted: 2014-10-01T18:15:33-07:00
by snibgo
Some shells will expand wildcards, so might expand "*.gif" into a list of all filenames that match.

Windoze does this, as I discovered by accident. My own programs can take the argument "/?" for help. This worked fine until I had a file named "x" in my root directory. So Windows translated "/?" into "/x" before passing it to my program, which then did the correct action for the argument "/x", even though I had merely asked for help. It took me two weeks to figure out that this wasn't a bug in my software. Grrr.

I hate this "feature".