How do I squish part of an image?
How do I squish part of an image?
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How do I squish part of an image?
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
On Windows, try
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
If on Unix, then try
Code: Select all
convert image.jpg -crop 100x50% \
\( -clone 0 -resize 100x150% \) \
-delete 0 +swap -append result.jpg
Code: Select all
convert image.jpg -crop 100x50% ^
( -clone 0 -resize 100x150% ) ^
-delete 0 +swap -append result.jpg
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?
Have a look at the "-distort" option.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How do I squish part of an image?
Following up on the above.glennrp wrote:Have a look at the "-distort" option.
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?
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?
Glennrp thank you for the suggestion. fmw42... the control points actually sound like a very useful way of tackling my problem. Thank you!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How do I squish part of an image?
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?
fmw42, the crop and resize -append works like a charm! I will have to learn more about this great tool.Thank you so much!