Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using beamer and having included the same image many times with pgf, declare once and insert.

It looks like the PS file from dvips grow linear as I create slides (the image is on the background). Reading online this should not be a problem on Unix systems, but the on windows it might be an issue.

Anyone have a solution as compiling takes around 1min now and the PS file is 200mb, not that handy?

How its used currently:

\pgfdeclareimage{redtree}{images/red_tree}%
\setbeamertemplate{background}{%
\pgftext[at=\pgfpoint{30mm}{\framesep-0.22\framesep},base,base]{\pgfuseimage{redtree}}
}
share|improve this question
1  
The PGF manual is not completely clear on this, but my inference from the way it is phrased is that the reuse of an existing image only makes a difference to file size for PDF output. As you're using PS, it may be that the image is reincluded for every use. –  Loop Space May 7 '12 at 8:40
1  
Is it a vector image (original EPS) or a raster image (which might have been converted to EPS)? AFAIK there is a way to define a PostScript macro which is reused every time. Is there a specific reason why you are using PS and not PDF? With PDF it is not an issue. –  Martin Scharrer May 7 '12 at 8:45
    
I am using PDF, but first dvips+ps2pdf. I just dont want that large ps file at every compile point for other reasons, speed, google drive uploads it every time ect. The pdf file is way smaller 20mb. –  s093294 May 7 '12 at 9:10
    
I think @AndrewStacey is correct that it somehow includes the image for every use, but as I am showing in my question, first declare and then use, i dont know why it does this. –  s093294 May 7 '12 at 9:11
    
The original eps image are a vector object. –  s093294 May 7 '12 at 9:12
show 6 more comments

1 Answer 1

The problem with including the same PostScript graphics multiple times is very well explained in chapter "16 Including An EPS File Multiple Times" of

Keith Reckdahl, "Using Imported Graphics in LaTeX and pdfLaTeX", 2006, URL: http://mirror.ctan.org/info/epslatex.pdf

The trick is that the original PostScript file is split in two parts. A header file for dvips loads the graphics data somehow in PostScript's memory and the actual PostScript image file is a small one that only loads the previously stored graphics file. The second file again gets included multiple times, but the file size is smaller, because the larger graphics part is only written once.

That makes a small PostScript size. But the PDF file is probably large, because the PDF generating application would have to recognize that the same graphics is included multiple times.

The reusing feature of PDF works with "form XObjects", they can be generated via pdfmark operators. The downside is that PostScript viewers are not too happy with this. The pictures that are loaded as XObject are not shown. However the PDF file will contain the picture only once and the file size is small.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.