how to resize image A.png according to B.png?
how to resize image A.png according to B.png?
e.g. B.png width is x, height is y. and how to resize A.png to x*y
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: how to resize image A.png according to B.png?
I think you cannot do this in one run; you have to write a script that
- 1) identifies the dimensions of image A and stores the result in a variable
2) resizes image B according to these values
Wolfgang Hugemann
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: how to resize image A.png according to B.png?
Basically correct. You need two steps, extract size of image B and resize image A (turn off aspect ratio preservation if that is a problem.
It can be done in one command using -distort Affine, where the viewport and distort parameters are set from another image, but that is very very tricky.
Basiccly combining.. Im Examples, Tranform Images, Accessing data from another image
http://www.imagemagick.org/Usage/transform/#fx_other
With something like Distort Resize, Internals
http://www.imagemagick.org/Usage/distorts/#resize
NOTE you will have to use the 'internals method' as the Distort Resize method uses a geometry string that can not use 'percent escapes', and really should be a resize operator, that is separate to distort.
IMv7 will have more direct facilities to use percent escapes in operatiosn such as resize, making this a lot easier.
It can be done in one command using -distort Affine, where the viewport and distort parameters are set from another image, but that is very very tricky.
Basiccly combining.. Im Examples, Tranform Images, Accessing data from another image
http://www.imagemagick.org/Usage/transform/#fx_other
With something like Distort Resize, Internals
http://www.imagemagick.org/Usage/distorts/#resize
NOTE you will have to use the 'internals method' as the Distort Resize method uses a geometry string that can not use 'percent escapes', and really should be a resize operator, that is separate to distort.
IMv7 will have more direct facilities to use percent escapes in operatiosn such as resize, making this a lot easier.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/