答案1
您可以使用选项(默认颜色编码是)。decodearray={rmin rmax gmin gmax bmin bmax}
\includegraphics
decodearray={0 1 0 1 0 1}
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\noindent
\includegraphics[decodearray={0 1 0 1 0 1},width=\textwidth]{ingmar.png}\\
\includegraphics[decodearray={1 1 0 1 0 1},width=\textwidth]{ingmar.png}\\
\includegraphics[decodearray={0 1 1 1 0 1},width=\textwidth]{ingmar.png}\\
\includegraphics[decodearray={0 1 0 1 1 1},width=\textwidth]{ingmar.png}
\end{document}
答案2
TikZ 提供了很多“滤镜”(请不要用现在的孩子们知道的滤镜)的可能性,可以通过 PDF 透明层应用于图像。第 23.3 节(混合模式)TikZ 手册用可能的“混合模式”来解释此功能normal
:multiply
,,,,,,,,,,,,,,和。以screen
overlay
darken
lighten
color dodge
color burn
hard light
soft light
difference
exclusion
hue
saturation
color
luminosity
这个帖子,你可以混合不同的混合模式来获得有趣的效果:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\includegraphics[width=10cm]{hBg1w.png}
\newcommand\colorize[2]{
\begin{tikzpicture}
\begin{scope}[blend group=#1]
\begin{scope}[blend group=#2]
\node[inner sep=0pt] (logo) {\includegraphics[width=10cm]{hBg1w}};
\fill[white] (logo.south west) rectangle (logo.north east);
\end{scope}
\fill[red] (logo.south west) rectangle (logo.north east);
\end{scope}
\node (logo.south) [below=.5cm,font=\Large] {#1/#2};
\end{tikzpicture}
}
\colorize{screen}{overlay}
\colorize{overlay}{saturation}
%\colorize{screen}{normal}
%\colorize{screen}{multiply}
%\colorize{screen}{screen}
%\colorize{screen}{overlay}
%\colorize{screen}{darken}
%\colorize{screen}{lighten}
%\colorize{screen}{color dodge}
%\colorize{screen}{color burn}
%\colorize{screen}{hard light}
%\colorize{screen}{soft light}
%\colorize{screen}{difference}
%\colorize{screen}{exclusion}
%\colorize{screen}{hue}
%\colorize{screen}{saturation}
%\colorize{screen}{color}
%\colorize{screen}{luminosity}
\end{document}