Here is a MWE:
Code: Select all
% test.tex
\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=0.5\linewidth]{../img/mytest.png}
\end{document}
When I compile this with `pdflatex test.tex`, and open the resulting pdf file in `evince`, if I zoom in to the picture I can see the individual pixels enlarged - i.e., there is no smoothing/anti-aliasing.
So, I looked about this a bit, and found this post:
Bug #199916 in poppler (Ubuntu): “evince interpolates image by mistake”:
... and then I realized, that this 'anti-aliasing' of images that I want is probably due to a PDF command; so I tried to insert a "/Interpolate true" command in the PDF:https://bugs.launchpad.net/ubuntu/+source/poppler/+bug/199916 wrote: evince ... shows images interpolated, if the pdf does not say "/Interpolate true".
If the pdf not says "/Interpolate true", evince should show the image not interpolated.
Code: Select all
$ sed -i 's!/Filter/FlateDecode!/Filter/FlateDecode\n/Interpolate true!' test.pdf
So, I was trying to see whether there is an option to set interpolation for images in relation to `pdflatex` or `hypersetup`, couldn't find anything.
Finally, I thought, if there isn't some option for that, maybe the easiest would be to write directly to the pdf file from latex; I found references to `\pdfcatalog` in "[pdftex] options of \hypersetup{pdfpagemode=PageWdth}", and `pdfobj` in "Getting braces into \pdfobj, for a Document-level JavaScript. HOW?". ...
However, the problem is that apparently one would need to insert that PDF command in the "middle" of an `\includegraphics` - I tried the following:
Code: Select all
\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\begin{document}
\includegraphics[width=0.5\linewidth]%
% \immediate\pdfobj{/Interpolate true} % crashes w: "Error: File `\immediate .png' not found."
{../img/mytest.png}
\immediate\pdfobj{/Interpolate true} % compiles here, but ends up on top of .pdf file as separate object; no effect on image
\end{document}
So, does anyone have an idea how can I persuade pdflatex to interpolate (smooth) the images??
Thanks in advance,
Cheers!
PS, off-topic: I wander why the subject length in the is so conservative? I would have gladly written the title as "Pdflatex: how to insert arbitrary PDF code (image interpolation)", but there wasn't enough space
