Page 1 of 1

Batch Script to Resize, Rotate, Overlay, Reposition and Crop Two Images

Posted: 2015-07-18T09:05:39-07:00
by miaho
Hi,

I need a batch script for the following...

I have two images: photo.jpg and overlay.png

1] The photo.jpg needs to be resized from 3456x2304 to 2406x1604 and rotated 345 degrees

2] Then the overlay.png image needs to be placed over the distorted photo while using the center points of the original photo and the overlay as tie points and offset the overlay by X(-90) Y(-160)

3] Then the resulting image needs to be cropped to the the dimensions of the overlay.png file (1864x1228) and saved as photo_overlay.jpg

Please see images below:
Photo: https://www.dropbox.com/s/iprfjxohffhxq ... o.jpg?dl=0
Overlay: https://www.dropbox.com/s/frtliwkr426wn ... y.png?dl=0
Preview (not to scale): https://www.dropbox.com/s/60n2ohx9j90dy ... d.jpg?dl=0
Output (not to scale): https://www.dropbox.com/s/e353h26zhd579 ... y.jpg?dl=0

I'd be happy to pay, however I will need some idea of cost before we get stuck in.

Thanks

Re: Batch Script to Resize, Rotate, Overlay, Reposition and Crop Two Images

Posted: 2015-07-18T09:28:04-07:00
by snibgo
You should also say what shell script language you need. Here it is in Windows BAT syntax:

Code: Select all

convert photo.jpg ^
  -resize "2406x1604^!" ^
  -rotate 345 ^
  overlay.png ^
  -gravity Center ^
  -geometry -90+160 ^
  +swap ^
  -compose DstOver -composite ^
  photo_overlay2.jpg
I have taken liberties with "-geometry" to match your sample instead of your text.

No charge.

Re: Batch Script to Resize, Rotate, Overlay, Reposition and Crop Two Images

Posted: 2015-07-18T11:50:28-07:00
by miaho
That's absolutely perfect! Many thanks, but seriously "No Charge"? If you want to PM me your PayPal details, I'd be happy to make a donation. Thanks again!