Re: [R] Shrink file size of pdf graphics

2011-05-22 Thread Layman123
Thank you very much for the tip! Using imagemagick i got an image of reasonable 
quality without making the file size that large. Regards Roman Von: 
quot;Philipp Pagel-5 [via R]quot; 
lt;ml-node+3537871-1637924423-125...@n4.nabble.comgt; Gesendet: 20.05.2011 
09:50:42 An: Layman123 lt;romanhorn...@web.degt; Betreff: Re: Shrink file 
size of pdf graphics On Thu, May 19, 2011 at 01:35:51PM -0700, Layman123 wrote: 
gt; I tried both, the plot devices in R and pdftk. First I tried the 
png-device, gt; but as I wanted to increase the number of pixels with 'width' 
and 'height', gt; the labels are getting smaller When I really need a png, I 
usually produce a pdf or eps first and then convert to png of the desired 
resolution with the convert command of imagemagick (but of course any other 
software, like e.g. Photoshop, should work fine, too). That way I don't have to 
figure out the correct paramters to make the png the way I want it and I have 
the additional benetfit of a vector g!
 rpahics quot;master filequot; that I can esily use to produce addictional 
verison in differnent resolutions etc. gt; Is there a way to do this with the 
gs-command so that it would be even more gt; compressed? Possibly, but of 
course there is a limit to how much you can compress a file without resorting 
to lossy compression. You may have hit that limit. cu nbsp; nbsp; nbsp; 
nbsp; Philipp -- Dr. Philipp Pagel Lehrstuhl fuuml;r Genomorientierte 
Bioinformatik Technische Universitauml;t Muuml;nchen Wissenschaftszentrum 
Weihenstephan Maximus-von-Imhof-Forum 3 85354 Freising, Germany 
http://webclu.bio.wzw.tum.de/~pagel/ 
__ [hidden email]  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. If you reply to this email, your message 
will be added to the discussion below: http://r.78!
 9695.n4.nabble.com/Shrink-file-size-of-pdf-graphics-tp3536042p3537871.
html To unsubscribe from Shrink file size of pdf graphics, click here . 


--
View this message in context: 
http://r.789695.n4.nabble.com/Shrink-file-size-of-pdf-graphics-tp3536042p3542242.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Shrink file size of pdf graphics

2011-05-20 Thread Philipp Pagel
On Thu, May 19, 2011 at 01:35:51PM -0700, Layman123 wrote:

 I tried both, the plot devices in R and pdftk. First I tried the png-device,
 but as I wanted to increase the number of pixels with 'width' and 'height',
 the labels are getting smaller

When I really need a png, I usually produce a pdf or eps first and
then convert to png of the desired resolution with the convert command
of imagemagick (but of course any other software, like e.g.
Photoshop, should work fine, too). That way I don't have to figure out
the correct paramters to make the png the way I want it and I have the
additional benetfit of a vector grpahics master file that I can
esily use to produce addictional verison in differnent resolutions
etc.

 Is there a way to do this with the gs-command so that it would be even more
 compressed?

Possibly, but of course there is a limit to how much you can compress
a file without resorting to lossy compression. You may have hit that
limit.

cu
Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/

__
R-help@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] Shrink file size of pdf graphics

2011-05-19 Thread Layman123
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?

Thank you very much in advance! Any tips are appreciated much!

Regards
Roman

--
View this message in context: 
http://r.789695.n4.nabble.com/Shrink-file-size-of-pdf-graphics-tp3536042p3536042.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Shrink file size of pdf graphics

2011-05-19 Thread Prof Brian Ripley

This was answered on this list a few days ago.  See

https://stat.ethz.ch/pipermail/r-help/2011-May/278029.html

On Thu, 19 May 2011, 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?


Of course!  What does ?Devices show on your unstated system and 
unstated R version?  Most likely it will contain something like


• ‘png’ PNG bitmap device

• ‘jpeg’ JPEG bitmap device

• ‘bmp’ BMP bitmap device

• ‘tiff’ TIFF bitmap device

• ‘bitmap’ bitmap pseudo-device via ‘Ghostscript’ (if
  available).


Thank you very much in advance! Any tips are appreciated much!


Tip: follow the footer of this message and do your homework before 
posting.




Regards
Roman

__
R-help@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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@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.


Re: [R] Shrink file size of pdf graphics

2011-05-19 Thread Duncan Murdoch

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@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.


Re: [R] Shrink file size of pdf graphics

2011-05-19 Thread Aaron Mackey
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.dun...@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@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@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.


Re: [R] Shrink file size of pdf graphics

2011-05-19 Thread Layman123
Thank you all for the quick answers!

I googled first instead of having the idea to search this forum...
I'm using R 2.12.2 on a 32-bit Computer with windows installed.

Up to this point I was trying to get the image the way I would like to have
it, but didn't get fully satisfactory results.
I tried both, the plot devices in R and pdftk. First I tried the png-device,
but as I wanted to increase the number of pixels with 'width' and 'height',
the labels are getting smaller. Yet attempting to prohibit this manually
with 'cex' doesn't give satifactory results. Searching the list I read about
the package 'cairoDevice' that would prevent this, increasing only the
resolution of the image and changing nothing about the size of the objects
in the plot. After I managed to install it, I got an error trying to open a
'Cairo'-device. I probably missed to install something. The CRAN-page
doesn't state anything on how to do this. Is there a way in R to produce
images with high resolution?

Using pdftk I managed to compress the file size from 13 MB to 3,6 MB. This
is really a good compression. However I would need an even smaller file
size. Unfortunately I saw your post very late, Aaron. With this command, a
pdf of size 3,4 MB was produced. pdftk doesn't seem to offer any options to
take influence on how much the pdf is compressed. 
Is there a way to do this with the gs-command so that it would be even more
compressed?

--
View this message in context: 
http://r.789695.n4.nabble.com/Shrink-file-size-of-pdf-graphics-tp3536042p3536850.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.