Quantcast
Channel: Caching includegraphics{} image files for speed - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 2

Caching includegraphics{} image files for speed

$
0
0

our graphics files were created by third parties. I don't have much control over them. I do have access to Imagemagick, so I can shrink and/or manipulate them.

for example, I have a 200KB (modest-file size) png image that uses unreasonably large canvas sizes:

  Image Width: 10200 Image Length: 13200  Bitdepth (Bits/Sample): 4  Channels (Samples/Pixel): 1  Pixel depth (Pixel Depth): 4  Colour Type (Photometric Interpretation): PALETTED COLOUR with alpha (5 colours, 1 transparent)   Image filter: Single row per byte filter   Interlacing: No interlacing   Compression Scheme: Deflate method 8, 32k window  Resolution: 47245, 47245 (pixels per meter)  FillOrder: msb-to-lsb  Byte Order: Network (Big Endian)  Number of text strings: 0 of 0

This png file will be enclosed with

  \includegraphics[width=0.33\textwidth]{image.png}

this works out great...except it takes pdflatex about 10 seconds to do this. I have similar issues with large-size .jpg canvas images, too. Multiply the delays by 20-50 images, and you see my point.

I do not want draft mode. I would like to see my images and I don't want them degraded. Is there a way to cache the png file into what pdflatex actually includes, so that on subsequent runs the pdflatex compilation is a lot faster?

advice appreciated.

EDIT: More complex:

  1. I think fast png inclusion does not work with transparency in the image. so the following fails:

    pngtopnm f.png | pnmtopng > f.png ; convert f.png -transparent white f.png

  2. conversion of my file with Imagemagick worries me. latex tells me the pt size of the image that it scales to, but this can have many or few pixels, depending on the output destination resolution.

so, the two simple solutions are not working in my case, I think.

/iaw


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images