run batch file on a single image

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
cristinaaaa

run batch file on a single image

Post by cristinaaaa »

Hi. I'm new to image magick and I am absolutely ignorant when it comes to scripting and such. Please forgive me if this is a really stupid question.

I have made a batch file and added it as a context menu action for .jpg files. What I want is to be able to right click a .jpg, click the new action, and have as output two separate files named resized.jpg and flipped.jpg, both 200x200 px

I've used this:

convert -resize 200x200 *.jpg resized.jpg
convert -flip resized.jpg flipped.jpg

Ok. I don't know if it's the right way of doing it but it works. The problem is than when I have more than one jpg in a folder, the batch file runs all of them, instead of only the one that I right clicked. I'm sure there's a way of solving it, even if it's not ImageMagick related... Can somebody please point me to the right path? I'd really appreciate it. I've searched google with no success, basically because I don't really know what I should be searching for.

Thanks in advance for any help :)

cristina
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

*.jpg tells convert to operate on every jpg in the directory.
I haven't used right click context menus but I think if you change *.jpg to %1 it will pick up the name of the selected file.

Pete
cristinaaaa

Post by cristinaaaa »

thanks a lot for the quick reply :)

I tried that, but it doesn't work. When I associate the file type (jpg) to the new action, I browse to my resizeflip.bat file, and what windows writes inside the box is this:

"C:\Archivos de programa\ImageMagick\resizeflip.bat" "%1"

I had already read something about that %1 thingy (note my literate computer vocabulary :roll:) but placing it in the batch file instead of *.jpg returns nothing, no image.

Any other thoughts?
Post Reply