I want to plot a PNG image in PGFplots. While this basically works with the graphics keyword, my problem is that Apples Preview PDF viewer applies kind of anti-aliasing to the image. But in my case it is important to see the pixelwise elements (128x128 pixel) (see figures). I thought that the solution could be to plot not the PNG image directly but plotting it from the image data. Thus the image is not recognized as an image by Preview and thus is not anti-aliased.
Is there a way to plot an image directly from a 128x128x3 data array? Other solutions for my problem not using PGFplots are also okay.
\begin{tikzpicture}
\begin{axis}[
axis on top,
width=5cm,
height=5cm,
scale only axis,
enlargelimits=false,
axis equal=true,
tick align=outside,
tick pos=left,
tick style={black},
xmin=0,
xmax=128,
ymin=0,
ymax=128,
xtick={0, 64, 128},
ytick={0, 64, 128},
]
\addplot graphics[xmin=0,ymin=0,xmax=128,ymax=128] {fig/scaled.png};
\end{groupplot}
\end{tikzpicture}

\pdfliteral direct {/Interpolate true} \special {pdf:direct: /Interpolate true } \includegraphics[width=0.5\linewidth]{mytest.png} \pdfliteral{/Interpolate true}
\end{document}`
– Dr. Manuel Kuehner Mar 15 '21 at 22:18