Hello I am trying to get one of my packages to be less than 5Mb in size, and it is currently 72Mb installed. It is big because the single vignette includes half a dozen very large PDF images. The PDF files are created as part of the Sweave process. Using jpg images instead of PDFs is acceptable in terms of picture quality (although not perfect), and results in a very much smaller vignette. OK, so here?s my first plan and I?m not sure if it?s optimal:: 1. Produce the .jpg files by hand from my own PDF files. 2. Change the .Rnw file so that it doesn?t produce the PDF files and the vignette uses the .jpg files instead. 3. ship the package with the .jpg files and the modified .Rnw file. This is not ideal because it?s not reproducible: only *I* can create the jpg files from the original .Rnw file, as the new .Rnw file does not produce the PDF files. Or can I somehow coerce Sweave into producing jpg files instead of PDF? Can anyone advise? thanks Robin -- Robin Hankin Uncertainty Analyst hankin.robin at gmail.com
Never ever use JPEG for bitmap data plots. Use PNG instead. See attach image (origin unknown; it is *not* an xkcd comics). That should solve your issues. /H On Sat, Feb 12, 2011 at 1:54 PM, robin hankin <hankin.robin at gmail.com> wrote:> Hello > > I am trying to get one of my packages to be less than 5Mb in size, and > it is currently > 72Mb installed. ?It is big because the single vignette includes half a > dozen very large PDF > images. ?The PDF files are created as part of the Sweave process. > > Using jpg images instead of PDFs is acceptable ?in terms of picture > quality (although > not perfect), and results in a very much smaller vignette. > > OK, so here?s my first plan and I?m not sure if it?s optimal:: > > 1. ?Produce the .jpg files by hand from my own PDF files. > 2. ?Change the .Rnw file so that it doesn?t produce the PDF files and > the vignette uses the .jpg files instead. > 3. ship the package with the .jpg files and the modified .Rnw file. > > This is not ideal because it?s not reproducible: only *I* can create > the jpg files from the original .Rnw file, as the new .Rnw file does > not produce the PDF files. > > Or can I somehow coerce Sweave into producing jpg files instead of PDF? > > Can anyone advise? > > thanks > > Robin > > > -- > Robin Hankin > Uncertainty Analyst > hankin.robin at gmail.com > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >-------------- next part -------------- A non-text attachment was scrubbed... Name: PNG_vs_JPEG.png Type: image/png Size: 48018 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20110212/28b1d551/attachment.png>
On Sat, Feb 12, 2011 at 4:26 PM, Henrik Bengtsson <hb at biostat.ucsf.edu> wrote:> Never ever use JPEG for bitmap data plots. Use PNG instead. ?See > attach image (origin unknown; it is *not* an xkcd comics).Oops - missed to include the following: To generate PNGs, you can do it manually in the Sweave document, e.g. <<myFigure>>png("myFigure.png"); plot(1:10); dev.off(); @ \begin{figure} \resizebox{0.9\textwidth}{!}{\includegraphics{myFigure}} \caption{A caption.} \label{fig:aLabel} \end{figure}> > That should solve your issues./H> > /H > > On Sat, Feb 12, 2011 at 1:54 PM, robin hankin <hankin.robin at gmail.com> wrote: >> Hello >> >> I am trying to get one of my packages to be less than 5Mb in size, and >> it is currently >> 72Mb installed. ?It is big because the single vignette includes half a >> dozen very large PDF >> images. ?The PDF files are created as part of the Sweave process. >> >> Using jpg images instead of PDFs is acceptable ?in terms of picture >> quality (although >> not perfect), and results in a very much smaller vignette. >> >> OK, so here?s my first plan and I?m not sure if it?s optimal:: >> >> 1. ?Produce the .jpg files by hand from my own PDF files. >> 2. ?Change the .Rnw file so that it doesn?t produce the PDF files and >> the vignette uses the .jpg files instead. >> 3. ship the package with the .jpg files and the modified .Rnw file. >> >> This is not ideal because it?s not reproducible: only *I* can create >> the jpg files from the original .Rnw file, as the new .Rnw file does >> not produce the PDF files. >> >> Or can I somehow coerce Sweave into producing jpg files instead of PDF? >> >> Can anyone advise? >> >> thanks >> >> Robin >> >> >> -- >> Robin Hankin >> Uncertainty Analyst >> hankin.robin at gmail.com >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >
I usually do : <<label=xyFile, echo=FALSE>>png("xyPlot.png", width = 800, height = 800) @ <<label=xyPlot>>... ... ... # Code goes here. @ <<label=xyClose, echo=FALSE>>null <- dev.off() @ \begin{figure} \begin{center} \includegraphics{xyPlot.png} \end{center} \end{figure} ---- Original message ---->Date: Sun, 13 Feb 2011 10:54:37 +1300 >From: r-devel-bounces at r-project.org (on behalf of robin hankin <hankin.robin at gmail.com>) >Subject: [Rd] large vignette problem >To: r-devel at r-project.org > >Hello > >I am trying to get one of my packages to be less than 5Mb in size, and >it is currently >72Mb installed. It is big because the single vignette includes half a >dozen very large PDF >images. The PDF files are created as part of the Sweave process. > >Using jpg images instead of PDFs is acceptable in terms of picture >quality (although >not perfect), and results in a very much smaller vignette. > >OK, so here?s my first plan and I?m not sure if it?s optimal:: > >1. Produce the .jpg files by hand from my own PDF files. >2. Change the .Rnw file so that it doesn?t produce the PDF files and >the vignette uses the .jpg files instead. >3. ship the package with the .jpg files and the modified .Rnw file. > >This is not ideal because it?s not reproducible: only *I* can create >the jpg files from the original .Rnw file, as the new .Rnw file does >not produce the PDF files. > >Or can I somehow coerce Sweave into producing jpg files instead of PDF? > >Can anyone advise? > >thanks > >Robin > > >-- >Robin Hankin >Uncertainty Analyst >hankin.robin at gmail.com > >______________________________________________ >R-devel at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-devel-------------------------------------- Dario Strbenac Research Assistant Cancer Epigenetics Garvan Institute of Medical Research Darlinghurst NSW 2010 Australia
Thanks guys. It works perfectly best wishes rksh On Sun, Feb 13, 2011 at 2:00 PM, Dario Strbenac <D.Strbenac at garvan.org.au> wrote:> I usually do : > > <<label=xyFile, echo=FALSE>>> png("xyPlot.png", width = 800, height = 800) > @ > > <<label=xyPlot>>> ... ? ? ?... ? ? ? ... # Code goes here. > @ > > <<label=xyClose, echo=FALSE>>> null <- dev.off() > @ > > \begin{figure} > ? ?\begin{center} > ? ? ? ?\includegraphics{xyPlot.png} > ? ?\end{center} > \end{figure} > > ---- Original message ---- >>Date: Sun, 13 Feb 2011 10:54:37 +1300 >>From: r-devel-bounces at r-project.org (on behalf of robin hankin <hankin.robin at gmail.com>) >>Subject: [Rd] large vignette problem >>To: r-devel at r-project.org >> >>Hello >> >>I am trying to get one of my packages to be less than 5Mb in size, and >>it is currently >>72Mb installed. ?It is big because the single vignette includes half a >>dozen very large PDF >>images. ?The PDF files are created as part of the Sweave process. >> >>Using jpg images instead of PDFs is acceptable ?in terms of picture >>quality (although >>not perfect), and results in a very much smaller vignette. >> >>OK, so here?s my first plan and I?m not sure if it?s optimal:: >> >>1. ?Produce the .jpg files by hand from my own PDF files. >>2. ?Change the .Rnw file so that it doesn?t produce the PDF files and >>the vignette uses the .jpg files instead. >>3. ship the package with the .jpg files and the modified .Rnw file. >> >>This is not ideal because it?s not reproducible: only *I* can create >>the jpg files from the original .Rnw file, as the new .Rnw file does >>not produce the PDF files. >> >>Or can I somehow coerce Sweave into producing jpg files instead of PDF? >> >>Can anyone advise? >> >>thanks >> >>Robin >> >> >>-- >>Robin Hankin >>Uncertainty Analyst >>hankin.robin at gmail.com >> >>______________________________________________ >>R-devel at r-project.org mailing list >>https://stat.ethz.ch/mailman/listinfo/r-devel > > > -------------------------------------- > Dario Strbenac > Research Assistant > Cancer Epigenetics > Garvan Institute of Medical Research > Darlinghurst NSW 2010 > Australia >-- Robin Hankin Uncertainty Analyst hankin.robin at gmail.com