0

I'd like to know, would it be possible to change the position of a picture that is defined in a tcolorbox with for example fill overzoom image, or watermark ? By default, the image is centered, but I'd like to be able to choose if I put it on the right, left, or center it.

Thank you !

Example :

enter image description here

MWE

\documentclass{article}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\begin{document}
\includegraphics[width=10cm]{simpson}

By default the focus is on the middle part...
\begin{tcolorbox}[enhanced,width=7cm,height=7cm,interior style={fill overzoom image=simpson}]
\end{tcolorbox}
% And now I'd like to say please, focus on the right part,
% on the left part, or go 80% on the right...
\end{document}

1 Answer 1

2

You can use the starred version of the key to pass options to includegraphics and so use trim or viewport:

\documentclass{article}
\usepackage{tikz}
\usepackage[most]{tcolorbox}
\tcbuselibrary{skins}
\begin{document}
\includegraphics[width=5cm]{example-image-A}


\begin{tcolorbox}[enhanced,width=5cm,height=5cm,
       interior style={fill overzoom image*={trim=4cm 4cm 0cm 0cm}{example-image-A}}]
\end{tcolorbox}

\begin{tcolorbox}[enhanced,width=5cm,height=5cm,
       interior style={fill overzoom image*={viewport= 5cm 1cm 10cm 10cm}{example-image-A}}]
\end{tcolorbox}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .