Page 1 of 1

run batch file on a single image

Posted: 2007-01-17T20:00:44-07:00
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

Posted: 2007-01-17T20:18:48-07:00
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

Posted: 2007-01-17T20:36:25-07:00
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?