# Include PDF images with interpolate=true

I was happy to read that `\includegraphics` allows setting the `interpolate` flag for imported images:

``````\includegraphics[interpolate]{testimg}
``````

This works wonderfully if testimg is a PNG image. Unfortunately, it does not work if testimg is a PDF image (example pdf image).

Is there any way to import PDF images and have their interpolate flag be true?

-
Any raster objects in a PDF are put inside a "container" so they appear "vectorized", since PDF is natively a vector format. (Not sure of the technical terminology here.) So, from the point of view of `graphicx`, the image is already vectorized, even though it's technically not. I think the only way to get interpolation in a PDF would be to produce it whenever the PDF is produced from the raster graphic. Or simply include the original raster graphic in a raster format supported by `graphicx`. TLDR: `interpolate` doesn't make sense for PDF because it is a vector format. –  Paul Gessler Mar 6 at 16:41
Use raster formats for raster images; use vector formats for vector images. Less trouble overall (even if you don't do this). Perhaps you can get the original, un-PDFed image, or somehow cut it out of the PDF. –  vonbrand Mar 6 at 19:00
@vonbrand: Which format would you suggest for B/W raster images? In my experience, PDF B/W images have smaller file sizes compared with PNG and GIF. I think that's because of ZIP compression in PDFs. –  Frank Seifert Mar 6 at 19:08
Many (most?) PNG exporters have the ability to apply varying levels of compression to the image. The compression is always lossless, but the resulting size can vary considerably. For example, I saved the image you attached (which was a PNG), opened it up in IrfanView, and re-saved it as a second PNG with maximum compression. The file size shrunk by 47%. –  Mike Renfro Mar 6 at 19:50
@MikeRenfro: Fair enough, thanks. I think there is no general rule; on some B/W images, I do better with PDF on others with PNG. Image patterns or small files seem to favor PNG. Anyways, if PDF interpolate is not implemented in LaTeX, I'll either convert to PNG or keep two PDFs for every image, one with Interpolation, the other without. Not a major inconvenience (as of now). –  Frank Seifert Mar 6 at 20:08