Page 1 of 1

Crop and border in the wrong order?

Posted: 2007-03-27T15:16:36-07:00
by lenscape
Hi

The following:

Code: Select all

			convert \
				-crop +0+100 \
				-bordercolor silver \
				-border 10 \
				in.jpg \
				out.jpg
seems to do the border before the crop so the top border is cropped out of existence.

I've tried reordering the options but I can't simply get the image cropped then add the border to what's left.

I've tried using chop, too and I seem to end up with just the border!

Short of piping one convert with a crop into another convert with the border, I'm running short if ideas. What should I be doing? Thanks.

Re: Crop and border in the wrong order?

Posted: 2007-03-27T21:45:59-07:00
by anthony
Why do you expect IM to understand that you want things done in a particular order, when you don't tell IM the right order to do thing in. :?

You can't crop and add borders to an image that you have not read.
In fact IM probably should throw an error (or at least a warning).
But being the responsible program it is it justs trys its best to do what you asked.

What it did was a 'legacy mode' for backward compatibilty.
IM Examples, Legacy Mode
http://www.imagemagick.org/Usage/basics/#legacy
Just save up all the options, and do them when an image had been finally given.
This is a throw back to the bad old IM version 5 days, where this try of thing happened all the time.

If your READ in the image BEFORE you operate on it, it will work as expected...

Code: Select all

 convert \
            in.jpg \
            -crop +0+100 \
            -bordercolor silver \
            -border 10 \
            out.jpg
and all will be done in the order you expect because you gave it in the order YOU want it to be done in.

Re: Crop and border in the wrong order?

Posted: 2007-03-28T12:43:07-07:00
by lenscape
Thanks for that. It did the trick although I thought I'd already tried that approach.