I am using Magick++. My program continuously reads dynamically varying JPEG images from the disk. These images are written to the disk continuously by another program. The images are of the same object (say a square or a cube or a teapot). But they are dynamically varying in pixel aspect ratio and resolution. I want to display these images with fixed pixel aspect ratio and fixed resolution. Here is what I do -
Pseudo code -
total_rows = image height;
total_cols = image width;
if(image height > image width) {
total_cols = image width + (image height / image width)
}
else if(image width > image height) {
total_rows = image height + (image width / image height)
}
image.extnt(total_rows X total_cols, CenterGravity)
This gives me images of fixed pixel aspect ratio across all images. But the images are dynamically varying in resolution.
How can I get a fixed resolution as well? I tried to use image.resize (tried with both with and without ! option) after using image.extent but it changes the pixel aspect ratio.
Appreciate any help/pointers. Thanks in advance.
fixed pixel aspect ratio and fixed resolution
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: fixed pixel aspect ratio and fixed resolution
-resample will fix resolution to the settings given. This is basically a resize with calculations based on changes in resolution.
http://www.imagemagick.org/Usage/resize/#resample
http://www.imagemagick.org/Usage/resize/#resample
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/