> > If you want to crop a list of images A, B, C,... > > and save each of the cropped images as their cropped > > version, how is this achieved within the one convert command?
> If it is even possible, it's probably not worth it. Far easier to embed a > single-file convert command in a loop, either in a shell script (Unix or > win32/Cygwin), batch file (Windows), or external program of some kind. > > Just for the heck of it, here's a Windows batch file: > > for /f %%i in (filelist.txt) do ( > convert "%%i" -crop 200x200+10+10 "tmp-%%i" && del "%%i" && ren "tmp- %%i" > "%i" > ) > Thanks Ross. However a) Invoking convert multiple times can be slow (have previously used a `for' loop to discover that). b) The multiple crop command is already embedded in a large shell batch file of various IM commands. c) I can see a way convert should work > Have a look at the mogrify command. > http://imagemagick.org/script/mogrify.php Thanks Pete. Trying to stick to `convert' for reasons previously given and I can see a way it should work. > Well, as far as I can tell, you cannot do it _within_ convert. Thanks Vasile, but I can see a way convert might work using -write and +delete, but I encountered errors. > You can also do it with convert but have to identify each image > separately and use -write. You have to put each of the images except > the last into parenthesis. > convert \( imageA.jpg -crop 100x100+50+50 +repage -write > imageAcrop.jpg +delete \) \ > \( imageB.jpg -crop 150x150+200+200 +repage -write imageBcrop.jpg +delete \) \ > imageC.jpg -crop 75x75+300+300 +repage imageCcrop.jpg Thanks Fred Actually, I tried variations of that and kept encountering error messages. So with increased confidence due to your example, I went back to the batch file to look for differences but found nothing significant. However, I might have had a space after one of the `\' because after adjusting the layout a little, it worked!! What I was trying to use, which did eventually work was a slight variation on the above: convert \( A.gif -crop 100x100+50+50 +repage -write AA.gif \) \ +delete \ \( B.gif -crop 150x150+200+200 +repage -write BB.gif \) \ +delete \ ... Z.gif -crop 75x75+300+300 +repage ZZ.gif PS: I have to use gif files not only for historical reasons. Of more importance, is the fact that a large number of features in the images must each retain their specific `standard' colour. Regards _______________________________________________ Magick-users mailing list [email protected] http://studio.imagemagick.org/mailman/listinfo/magick-users
