Pixel aspect ratio correction

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
rolikoff

Pixel aspect ratio correction

Post by rolikoff »

Everybody should know the Photoshop's PAR correction. Does anybody know do imagemagick has the same feature (command-line) or not?
Thank you, Dmitry.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Pixel aspect ratio correction

Post by fmw42 »

Not everybody has or uses Photoshop or is even familiar with pixel aspect ratios.

Nevertheless, this is only important if you want to convert between digital still images or digital images for video. Still images generally use square pixels. Digital video uses non-square pixels, typically with aspect ratios of 4:3, 3:2 or 2:1. These happen to match the dimensions and image aspect ratios of some cameras (presumably so that the digital video is square). A good article is at http://www.videouniversity.com/articles ... and-tricks.

First, I don't think that IM has the ability to recognize pixel aspect ratios in the headers of files. I could be wrong. I also don't think it can automatically change the pixel aspect ratio for you.

However, if you know the pixel aspect ratio and want to change it from square to that aspect ratio or go the other way, then all you need to do is create a new image whose size is changed by that aspect ratio. So for example if you want to go from square to 3:2 aspect ratio, then

convert squareimage.jpg -resize 150% rectangularimage.jpg

where 3:2 is equivalent to 3/2=1.5 or 150%
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Pixel aspect ratio correction

Post by anthony »

Fred you need the \! flag for aspect ratio changes...

Code: Select all

  -resize 150x100%\!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Pixel aspect ratio correction

Post by fmw42 »

anthony wrote:Fred you need the \! flag for aspect ratio changes...

Code: Select all

  -resize 150x100%\!

Right and I also forgot the other dimension. Your formula is correct.
Post Reply