Re: [R] Shrink file size of pdf graphics

From: Aaron Mackey <amackey_at_virginia.edu>
Date: Thu, 19 May 2011 13:18:43 -0400

You can try something like this, at the command line:

  gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

evidently, the new compactPDF() function in R 2.13 does something very similar.

-Aaron

On Thu, May 19, 2011 at 11:30 AM, Duncan Murdoch <murdoch.duncan_at_gmail.com> wrote:
>
> On 19/05/2011 11:14 AM, Layman123 wrote:
>>
>> Hi everyone,
>>
>> My data consists of a system of nearly 75000 roads, available as a
>> shapefile. When I plot the road system, by adding the individual roads with
>> 'lines' and store it as a pdf-file with 'pdf' I get a file of size 13 MB.
>> This is way too large to add it in my LaTeX-document, because there will be
>> some more graphics of this type.
>> Now I'm curious to learn wheter there is a possibility in R to shrink the
>> file size of this graphic? I merely need it in a resolution so that it looks
>> "smooth" when printed out. I don't know much about the storage of R
>> graphics, but maybe there is a way to change the way the file is stored
>> perhaps as a pixel image?
>
>
> There are several possibilities.  You can use a bitmapped device (e.g. png()) to save the image; pdflatex can include those.
>
> You can compress the .pdf file using an external tool like pdftk (or do it internally in R 2.14.x, coming soon).
>
> There are probably others...
>
> Duncan Murdoch
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 19 May 2011 - 17:21:30 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 19 May 2011 - 20:50:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive