ImageMagick6 icon indicating copy to clipboard operation
ImageMagick6 copied to clipboard

Difference between Image size & page size

Open joonsung-kim opened this issue 6 years ago • 1 comments

Hi. I am confused about the size difference between image size and page (virtual canvas?) size.

Below is a result from the identify command on the mysterious image. $ identify test.png test.png PNG 794x8984 794x1123+0+0 8-bit sRGB 3.12123MiB 0.000u 0:00.000

I thought that virtual canvas is used for some specific image formats (e.g., gif), and, PNG images do not use the concept of the virtual canvas.

I used below functions to extract the image & page size, respectively.

=> Image size t_img_width = MagickGetImageWidth(wand); t_img_height = MagickGetImageHeight(wand);

=> page size MagickGetImagePage(wm_wand, &t_wm_img_width, &t_wm_img_height, &t_wm_img_x, &t_wm_img_y)

Which size should I use for image processing (resize, crop)? Is that "image size" is a representative image size? or the page(virtual canvas) size of the first image is the representative size?

joonsung-kim avatar Mar 25 '20 06:03 joonsung-kim

PNG groks the virtual canvas. You can remove the virtual canvas with MagickResetImagePage().

urban-warrior avatar Jul 19 '20 23:07 urban-warrior