Page 1 of 1

overlaying a canvas on an image

Posted: 2015-11-02T01:25:46-07:00
by user001
I am trying to overlay a canvas (specifically a white rectangle of defined size) on an image. The following command, which I expect to overlay a rectangle of 100 pixel width and 4 pixel height, does not overlay a rectangle of the expected size:

convert file.tif -gravity center -crop 50%x50% 'xc:white[100x4!]' -gravity southeast -geometry +10+10 -composite x:

I have tried various permutations, but the pixel size of the rectangle is not correct. For instance, when file.tif has dimensions 333x390, the white bar is longer than half the image width, which should not be the case. Please advise on how the task can be accomplished properly. Thank you.

PS: I am using ImageMagick 6.8.9-9 Q16 x86_64 2015-01-05 on a Debian 8 system.

Re: overlaying a canvas on an image

Posted: 2015-11-02T01:49:27-07:00
by snibgo
Why do you have "-geometry 50%x50%"? What do you want that to do?

Re: overlaying a canvas on an image

Posted: 2015-11-02T02:40:17-07:00
by user001
Apologies, it was supposed to be "crop." I edited the post to make this correction.

Re: overlaying a canvas on an image

Posted: 2015-11-02T03:17:49-07:00
by snibgo
Okay. Did that solve the problem? It would be usual to put "-crop 50%x50%+0+0", with "+repage", but that makes no difference to the image.

If that didn't solve it, please show your input and output. You can put them somewhere like dropbox.com and paste the URLs here.

Re: overlaying a canvas on an image

Posted: 2015-11-02T03:37:39-07:00
by user001
Oh, indeed! I just checked my terminal emulator history and found that I made the same mistake (trying to use the syntax "-geometry X%xY% -crop" instead of "-crop X%xY%"). A regrettable error, for the resolution of which I convey my sincerest thanks.