You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by david <ov...@gmail.com> on 2009/01/14 04:36:58 UTC

pdf file size with image scaled/resized

Hi


I kinda new to FOP and been experimenting with fop for my project (fop 0.20 and
0.95)
I notice that after I resize a 40008 x 3112 image (which is 2.5mb in size) to
66m width and scale:uniform set, the resulting pdf size is 2.5mb too

but if i resize the image using paint.net to half of the original size, the file
size become 800kb and if i create the same pdf using that image, the pdf file
size goes down to 800kb

is there anyway I can achieve that resizing using fop or/and combined with some
other java library?

thanks



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: pdf file size with image scaled/resized

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 14.01.2009 09:30:12 Justus-bulk wrote:
> david <ov...@gmail.com> wrote on Wed, 14 Jan 2009 03:36:58 +0000
> (UTC):
> 
> > I notice that after I resize a 40008 x 3112 image (which is 2.5mb in
> > size) to 66m width and scale:uniform set, the resulting pdf size is
> > 2.5mb too
> 
> This is because FOP (as probably most page rendering engines) does not
> contain any image processing capabilities; it just includes the
> original image data and scales their rendering as specified.
> 
> > but if i resize the image using paint.net to half of the original
> > size, the file size become 800kb and if i create the same pdf using
> > that image, the pdf file size goes down to 800kb
> 
> Here you reduce the original image data (by smoothing and
> subsampling).
> 
> > is there anyway I can achieve that resizing using fop
> 
> This would probably be considered outside the scope of FOP.

Not necessarily. Help is welcome if anyone finds this is important.
However, this is not going to be trivial to integrate in FOP. But I'll
help with pointers if anyone wants to try.

> If your PDF is intended for printing, you should use images (scaled
> using your favorite image processing program) that come out to about
> 600dpi (here, pixels per inch), or whatever the physical resolution of
> your printer is. Less looks visibly worse; more needlessly increases
> file size and printing time.
> 
> If your PDF is only intended for on-screen viewing, similar reasoning
> applies; here the resolution can be much lower.
> 
> On the other hand, it would indeed be cool if FOP had a command-line
> switch to specify the target resolution of raster content in PDF
> output. Then, FOP could do such downscaling internally.

Well, the setting is already there (used for other purposes mostly).
Only for PCL this setting already results in downsampling because it
doesn't work otherwise. But enabling image downsampling for PDF, PS & Co.
should be a separate setting. Image downsampling costs a lot of CPU
power. Currently, we try to optimize image processing. For example, JPEG
and certain TIFF images don't even get decompressed when you create PDF.
That allows for lightning-fast image processing. Downsampling requires
decoding, downsampling and re-encoding the image.

> > or/and combined with some other java library?
> 
> Check out the J2SE packages javax.imageio and java.awt.image.
> 
> Justus



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: pdf file size with image scaled/resized

Posted by Ju...@Piater.name.
david <ov...@gmail.com> wrote on Wed, 14 Jan 2009 03:36:58 +0000
(UTC):

> I notice that after I resize a 40008 x 3112 image (which is 2.5mb in
> size) to 66m width and scale:uniform set, the resulting pdf size is
> 2.5mb too

This is because FOP (as probably most page rendering engines) does not
contain any image processing capabilities; it just includes the
original image data and scales their rendering as specified.

> but if i resize the image using paint.net to half of the original
> size, the file size become 800kb and if i create the same pdf using
> that image, the pdf file size goes down to 800kb

Here you reduce the original image data (by smoothing and
subsampling).

> is there anyway I can achieve that resizing using fop

This would probably be considered outside the scope of FOP.

If your PDF is intended for printing, you should use images (scaled
using your favorite image processing program) that come out to about
600dpi (here, pixels per inch), or whatever the physical resolution of
your printer is. Less looks visibly worse; more needlessly increases
file size and printing time.

If your PDF is only intended for on-screen viewing, similar reasoning
applies; here the resolution can be much lower.

On the other hand, it would indeed be cool if FOP had a command-line
switch to specify the target resolution of raster content in PDF
output. Then, FOP could do such downscaling internally.

> or/and combined with some other java library?

Check out the J2SE packages javax.imageio and java.awt.image.

Justus

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org