-1

I am using imagemagick to convert files and reposition them, i have a 4 * 6 png which i need to position on a letter canvas on the top half of the page.

I have the below command which i am using, but its confusing. can anyone suggest how i can achieve what i want.

this is what i have tried, can any one guide me on this.

convert -rotate -270 -page Letter me-9370120111400937899958.png on-9370120111400937899958.pdf

I have also tried this, but the overlayed image is not moving and is stuck to the bottom

%x{convert -page Letter -rotate -270 "/var/folders/rp/rk2q4l7j4ds_w37vwvgx46tr0000gn/T/a8.png" -geometry +50+50 "/var/folders/rp/rk2q4l7j4ds_w37vwvgx46tr0000gn/T/a8.pdf"}

I have tried reading on this link http://www.imagemagick.org/script/command-line-processing.php#geometry but could not figure out.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
opensource-developer
  • 2,826
  • 4
  • 38
  • 88
  • 1
    can the downvoter please explain the reason, i am trying and was confused hence i posted here, it something wrong in what i asked? – opensource-developer Oct 09 '15 at 14:14
  • `imagemagick` may be on topic when you're including it in the context of some programming problem, but on its own like this it really belongs on superuser.com. And you haven't given enough information to determine exactly what problem you're having anyway. – Mark Ransom Oct 09 '15 at 17:25
  • "It's confusing" is not a very good problem statement. That's why. – Lightness Races in Orbit Oct 12 '15 at 11:59

1 Answers1

1

Updated Answer

It occurred to me later that you may have meant this:

convert -page letter -gravity north \( a.jpg -background yellow -splice 0x10 \)   a.pdf

Obviously change yellow to none and increase the 0x10 to 0x20 to move further down the page, and add -rotate 90 before the splice maybe.

Original Answer

Not sure exactly what you mean, but I think this will get you started. Let's try some options. I will make the canvas yellow so you can see it and the file you want to position on top will be red.

So let's try some options...

First, let's move the image across to the right by zero pixels and down from the top-left by 40 pixels - the default position (or gravity) is NorthWest so we are positioning relative to that.

convert -size 612x792 xc:yellow a.jpg -geometry +0+40 -composite result.jpg

enter image description here

If you want the image centred, use -gravity north and position relative to that - a little closer to the edge this time maybe:

convert -size 612x792 xc:yellow -gravity north a.jpg -geometry +0+10 -composite result.jpg

enter image description here

If you want the background rotated:

convert -size 792x612 xc:yellow -gravity north a.jpg -geometry +0+40 -composite result.jpg

enter image description here

If you want just the overlay rotated, do that in "aside processing":

convert -size 612x792 xc:yellow -gravity north \( a.jpg -rotate 90 \) -geometry +0+40 -composite result.jpg

enter image description here

If you want the canvas white, change yellow to white. If you want the canvas transparent, change yellow to none.

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432