Page 1 of 1

How do I squish part of an image?

Posted: 2015-10-27T16:30:06-07:00
by wxguy
My apologies for lack of correct terminology... I am seeking assistance on how to adjust the size of part of an image. I want the bottom half of an image (.jpg) to remain the same, while resizing the Y-axis (height) of the top half of the image. (I am trying to adjust a satellite image so it overlays nicely in Google maps-adjusting for earth's curvature). Any assistance would be greatly appreciated.

Re: How do I squish part of an image?

Posted: 2015-10-27T16:45:41-07:00
by fmw42
What platform are you on? What version of Imagemagick? Please always provide that information. See viewtopic.php?f=1&t=9620

If on Unix, then try

Code: Select all

convert image.jpg -crop 100x50% \
\( -clone 0 -resize 100x150% \) \
-delete 0 +swap -append result.jpg
On Windows, try

Code: Select all

convert image.jpg -crop 100x50% ^
( -clone 0 -resize 100x150% ) ^
-delete 0 +swap -append result.jpg
First line crops in two equal vertical pieces.
Second line copies the top part and resize vertically by 150%
Third line removes the original top part and swaps the original bottom and new top and appends them to make the output


See
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/basics/#clone
http://www.imagemagick.org/Usage/crop/#crop_tile
http://www.imagemagick.org/Usage/resize/
http://www.imagemagick.org/Usage/layers/#append

Re: How do I squish part of an image?

Posted: 2015-10-27T19:32:00-07:00
by glennrp
Have a look at the "-distort" option.

Re: How do I squish part of an image?

Posted: 2015-10-27T20:20:10-07:00
by fmw42
glennrp wrote:Have a look at the "-distort" option.
Following up on the above.

You could use -distort Polynomial to a second or third order polynomial warping by picking control points on the appropriate map (projection) and finding corresponding points on the image. See http://www.imagemagick.org/Usage/distorts/#polynomial

Re: How do I squish part of an image?

Posted: 2015-10-28T12:40:14-07:00
by wxguy
fmw42, thank you for pointing me in the right direction. I am on Unix and ImageMagick 6.7.2-7. I'll attempt your suggestions :)

Re: How do I squish part of an image?

Posted: 2015-10-28T12:43:12-07:00
by wxguy
Glennrp thank you for the suggestion. fmw42... the control points actually sound like a very useful way of tackling my problem. Thank you!

Re: How do I squish part of an image?

Posted: 2015-10-28T14:41:53-07:00
by fmw42
IM 6.7.2.7 is ancient. About 200 versions old. I would suggest you upgrade if you can.

Re: How do I squish part of an image?

Posted: 2015-10-29T14:39:22-07:00
by wxguy
fmw42, the crop and resize -append works like a charm! I will have to learn more about this great tool.Thank you so much!