Save for Web in Photoshop with custom DPI


I am writing user documentation using DITA which allows me to easily generate deliverables in PDF, CHM and web formats. The images need to be saved with a DPI of 110 so that they are displayed correctly within the PDF documentation.

If I change the DPI of the image to 110 (without resampling) and save as a PNG or JPEG then this works fine with all outputs.

On average the image files are coming out with file sizes of between 50KB and 90KB. If I use the "Save for Web & Devices" feature of Photoshop the file sizes are reduced significantly to between 15KB and 40KB. So ideally I need to be saving files using this feature.

But... the DPI of the output file is changed to something else (I am guessing 72 DPI) which is causing the images to be scaled incorrectly by Apache FOP (for generating the PDF output). How can I change the value of the DPI metadata in the saved image files without loosing the ability to compress the files?

It might be possible to resolve this problem by altering some configuration or attriute of Apache FOP. I have posed the following question over at StackOverflow to find out:

5/23/2017 12:40:00 PM

Accepted Answer

I don't have any experience with it, but from the docs:

Some bitmapped image file formats store a dots-per-inch (dpi) or other resolution values. FOP tries to use this resolution information whenever possible to determine the image's intrinsic size. This size is used during the layout process when it is not superseded by an explicit size on fo:external-graphic (content-width and content-height properties).

( apache fo docs )

So try setting the content-height and content-width explicitly.

Also: imagemagick has a -density switch to alter the DPI flag without resampling

( imagemagick docs )

1/15/2013 7:24:00 PM