Re: [PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?
Hi, When the dpi values (pixel width and hight) are explicitely specified in the image, so it's easy to compute the actual size (IOW natural size). Many API or tools can read such values. When those values are not available, FOP uses its own pixel size, witch defaults to 1/72in. 2014-06-17 15:21 GMT+02:00 Dridi Seifeddine : > Thanks everyone, > > > > OK. I understand better now. Just one last question Vincent: How do you know > the “natural” size of an image? Isn’t it the size in pixels specified in the > image file? -- pascal - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?
Thanks everyone, OK. I understand better now. Just one last question Vincent: How do you know the "natural" size of an image? Isn't it the size in pixels specified in the image file?
Re: [PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?
On 17/06/14 10:46, Dridi Seifeddine wrote: Hello, Is that what you were trying to achieve? No. I want to leave the image as it is and prevent FOP from scaling up or down. Using this: If you want the image to appear at its natural size (16.3x10.8cm in the present case) then you should leave width/height and content-width/height unspecified: FOP will extract the image’s DPI and calculate its size in mpt accordingly. FOP implicitly assumes that the image's DPI is 72, so when calculating No it doesn’t. It assumes that the px unit you used in the width and height properties above resolves to 72px per inch. This has nothing to do with the image’s resolution. the mpt size we get (1919000, 1272000), and the image is rendered with no scaling applied. I’m not sure I understand what you mean. If you use fo:external-graphic in the way you show above, FOP effectively scales up the image by around 416% of its natural size. My question is: Is there any way to override the image's DPI in FOP using the config? If you want to override the image’s 300DPI resolution, then you just set content-width/height to scale-to-fit and width/height to any dimension you like. But I suspect that’s not what you’re asking for. If you want to honour the image’s resoltion of 300DPI, then you should leave width/height and content-width/height unspecified like explained above. Thanks Seifeddine HTH, Vincent - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?
Hi, px unit defaults to 1/72 in, but you can specify other size: either in conf file with source-resolution, or in logic with fopFactory.setSourceResolution() Note that px is device dependant. You should use absolute unit instead. 2014-06-17 10:46 GMT+02:00 Dridi Seifeddine : > Hello, > > > >>> Is that what you were trying to achieve? > > > > No. I want to leave the image as it is and prevent FOP from scaling up or > down. Using this: > > content-width="scale-to-fit" content-height="scale-to-fit"/> > > > > FOP implicitly assumes that the image’s DPI is 72, so when calculating the > mpt size we get (1919000, 1272000), and the image is rendered with no > scaling applied. > > > > My question is: Is there any way to override the image’s DPI in FOP using > the config? > > > > Thanks > > > > Seifeddine > > > > > > -- pascal - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
Re: [PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?
FOP does not implicitly assume that the pixel size is 72 dpi. FOP uses the pixel size (resolution) specified in the image. Since you are using JPEG and the resolution may be specified in the EXIF segment make sure you use trunk, not 1.1. If the image has no resolution (or the resolution is in the EXIF segment and you are using 1.1) then FOP defaults to 72dpi. You can change that specifying a different value in the element in the conf file. On Tue, Jun 17, 2014 at 9:46 AM, Dridi Seifeddine wrote: > Hello, > > > > >> Is that what you were trying to achieve? > > > > No. I want to leave the image as it is and prevent FOP from scaling up or > down. Using this: > > content-width="scale-to-fit" content-height="scale-to-fit"/> > > > > FOP implicitly assumes that the image’s DPI is 72, so when calculating the > mpt size we get (1919000, 1272000), and the image is rendered with no > scaling applied. > > > > My question is: Is there any way to override the image’s DPI in FOP using > the config? > > > > Thanks > > > > Seifeddine > > > > > > >
Re: [PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?
Hello, >> Is that what you were trying to achieve? No. I want to leave the image as it is and prevent FOP from scaling up or down. Using this: FOP implicitly assumes that the image's DPI is 72, so when calculating the mpt size we get (1919000, 1272000), and the image is rendered with no scaling applied. My question is: Is there any way to override the image's DPI in FOP using the config? Thanks Seifeddine
Re: [PDF Renderer] Why FOP scales down 300 dpi images and not maintain the intrinsic image dimension?
Hi Seifeddine, On 16/06/14 16:01, Dridi Seifeddine wrote: Hello, I see a strange issue when I render a 300 dpi image in PDF. The image is always scaled down. I understand that FOP uses mpt for its internal calculations, and the formula for pixels to mpt conversion depends on the horizontal/vertical dpi specified in the image (valueMpt = valuePx * 1000 * 72 / dpi). Thus, the higher the dpi value, the lower the image size in mpt unit. When I specify the image's width and height, and set attributes content-width="scale-to-fit" content-height="scale-to-fit", FOP does no scaling. The image looks fine in the PDF file you attached. Having left width/height and content-width/height unspecified, the image is left to its default size which is approximately 16.3x10.8cm. If you want to scale the image up so that it fills the width of the page, then you have to set content-width to scale-to-fit /and/ width to, e.g., 100%: If you leave width unspecified then the image will remain at its default size. Is that what you were trying to achieve? Thanks Seifeddine HTH, Vincent - To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
