Page 1 of 1

[SOLVED] merge 2imgs horiz.centre, vert. start 0.88"from top

Posted: 2014-04-07T11:28:39-07:00
by tukusejssirs
I want to combine (compose, merge or whatever you wanna call it) 2 images of 300 dpi. Bg image is fully white of size A5. Fg images vary in size, but they all fit in A5. What I did is the following:

Code: Select all

convert bg.tif fg.tif -gravity center -composite new.tif
This cmd centred the fg image horizontally and vertically, while I’d like to centre it only horizontally, but vertically the fg image should start 0.88 inches from the top of the bg image.

Info: ImageMagick 6.7.7-10 2013-09-10 Q16 run in terminal of Ubuntu Gnome 13.04 i386

Re: merge 2 imgs horiz. centred, vert. start 0.88" from top

Posted: 2014-04-07T12:01:59-07:00
by fmw42
IM does not work in inches or dpi units. It works in pixels. So you need to convert your vertical offset from inches to pixels given your 300 dpi resolution. Then

Code: Select all

convert bg.tif fg.tif -gravity north -geometry +0+Y -composite new.tif
Where Y is the pixel offset from the top of the image. -gravity north sets the image at the top center. -geometry defines the offset from top center.

Y=300/.88 = 341

Re: merge 2 imgs horiz. centred, vert. start 0.88" from top

Posted: 2014-04-07T13:11:28-07:00
by tukusejssirs
The first step I have not been yet able to accomplish from terminal, so I opened gimp,

1. created new image (ctrl+n),[/list]
2. template: A5 (300 ppi)[/list]
3. after clicking on Advanced options, fill with: White[/list]
4. click on ok (or press enter)[/list]

Then exported (ctrl+e) it to bg.tif (when asked, select No compression and export/enter). For it had about 13 MB, I decided to scantailor it (the way as other scanned images to have the same qualities).

And finally, the command:

Code: Select all

composite -gravity center -gravity north -geometry +0+264 130b.tif blnk_300.tif new.tit
I just tried to use multiple ‘-gravity’ settings and it just worked!

Re: [SOLVED] merge 2imgs horiz.centre, vert. start 0.88"from

Posted: 2014-04-07T13:24:08-07:00
by fmw42
I just tried to use multiple ‘-gravity’ settings and it just worked!
That is because the -gravity center was likely replace by the subsequent -gravity north. The rest of the command was just as I suggested for use with -gravity north