getting a limited number of files from imageMagick
I'm trying to make a compilation of 3 thumbs which cover the top of an image. I'm us开发者_开发技巧ing the following command line command for that:
convert cap/test.jpg -resize 300x -crop 100x135 -strip cap/t.jpg
this resizes the image and cuts it up in 100x135 tiles. But I get more than the top 3 only. I don't need those. I can simply keep the first 3 and delete the rest, but that feels like inefficient programming. Is there a way to limit the number of files written by imageMagick to 3?
eventually I fixed this by making one image with a fixed width and height which I then cut up in 3 separate images. Seems like double work though, since the images are processed twice. Can't be good for the quality either. So here's the workaround:
convert cap/test.jpg resize 300x -gravity north -crop 300x135+0+0 -crop 100x135 -strip cap/t.jpg
but like I said, this processes the image more that absolutely necessary I think. If anybody knows a better solution I'm very interested!
精彩评论