Forum How do I...?

problem with image size and resolution

ixgal
hi,

I have had some problems with image sizes and resolution. Please see this simple example enclosed.
There are 2 images: one has 300dpi a 1cm width. The other one has 150dpi and 2cm width (actually it's the same image, resized).

In the PDF they appear with the same size and resolution.

In the CSS I tried by adding prince-image-resolution:auto, also prince-image-resolution:normal, but no luck (the result is the same).

If I set image-resolution:300dpi, I will get the right size for the image at 300dpi, but not for the other one.

Any tip on how to solve it?
thanks
  1. html_images.html0.6 kB
  2. html_images.pdf55.8 kB
mikeday
Apparently both images are 118x53 pixels in size, and neither of them have any intrinsic resolution specified in the file.
ixgal
thanks. But on Photoshop and on the Window browser I can see their resolution (300dpi and 150dpi).
Are you using another method to check whether they have an intrinsic resolution? Just to check if I am skipping a step somewhere in the process
mikeday
It seems that JPEG has two ways of specifying image resolution, in the standard metadata block and in the Exif metadata, which Prince does not currently check.

Unless you can save the resolution in the standard metadata block it will be necessary to use the prince-image-resolution property to explicitly set 300dpi for one image and 150dpi for the other.
ixgal
hi Mike, thanks.
Is there a way to check the image resolution in standard metadata block? I only found the way the check the Exif metadata (using Photoshop, for example), but I am not sure which is the other resolution that Prince is using.
mikeday
Does it show up in the Image Size dialog box?
ixgal
in Photoshop, what I get in Image Size dialog is:

image1.jpg:
width = 1cm
height = 0.45cm
resolution: 300dpi
--------
image2.jpg:
width = 2cm
height = 0.9cm
resolution: 150dpi
--------
When I export to PDF, they appear with the same size (it seems that Prince is using 96dpi by default, even if I set prince-image-resolution:auto or prince-image-resolution:normal.
mikeday
We may need to support the EXIF data to make this work. In the meantime, it will be necessary to specify the image resolution manually, eg. "300dpi".
ixgal
hi Mike, thanks. Please let me know if in the future Prince supports the EXIF data
mikeday
Prince 11 is now out and supports reading JPEG resolution from EXIF metadata! :D
ixgal
thanks! I will try it