0

I have an image with some text. I want to attach this image in the main document while hiding the text on the image. Below is the screenshot of the image-

enter image description here

I am using trim and clip options provided by includegraphics to achieve the same. Below is the code snippet:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}
    \centering
    \includegraphics[trim={0 0 0 1cm}, clip, width=10cm]{text_image}
    \caption{An image with hidden text}
    \label{fig:example}
\end{figure}
\end{document}

Please see a screenshot of the generated document below:

enter image description here

In the default setting, the text is hidden. However, when I move the mouse over it and click to select, I can see this text.

I really want to crop/hide the text. Any workaround, please?

ravi
  • 1,618
  • 1
    If the information should be gone entirely, edit the image with some image editing tool (e.g. gimp) before including. If you use tex to crop the image, the information is still retrievable, for example when editing the pdf with inkscape the cropping can be undone or the text can simply be copied from the pdf. – samcarter_is_at_topanswers.xyz Jan 22 '19 at 14:45
  • @samcarter: Thank you very much. The image in reality is a plot which is a PDF file. On the top of the plot, I generally write some information (for my own understanding). – ravi Jan 22 '19 at 14:48
  • 1
    You could use inkscape to edit the plot and remove all the text you don't want. – samcarter_is_at_topanswers.xyz Jan 22 '19 at 14:49
  • @samcarter: I understand your concerns. Basically what you are saying is that consider we have document-1.pdf. Create document-2.pdf and then use it inside main.tex. However I don’t want to create this intermediate document. Any suggestions? – ravi Jan 22 '19 at 14:52
  • Yes this is my suggestion. This also has the advantage that one can save the plot as pdf+tex, which means that the fonts of the plot will automatically match the ones from your main file. (there are other routes as well, for example export as tikz...) – samcarter_is_at_topanswers.xyz Jan 22 '19 at 14:56
  • some related questions: https://tex.stackexchange.com/questions/462372/included-pdf-image-has-invisible-but-selectable-text?noredirect=1&lq=1 https://tex.stackexchange.com/questions/334855/remove-clipped-image-sections-from-included-pdf – samcarter_is_at_topanswers.xyz Jan 22 '19 at 15:05
  • @samcarter: thanks again. I am having a look at related questions! – ravi Jan 22 '19 at 15:09
  • Bottom line seems to be easiest to use another tool to prep a second copy just for public use (you probably have a copy of GhostScript in your software repertoire? that could be invoked most simply by an external shell script) without knowing how your main.tex calls includes of other tex with images however it might be possible to use an \IF this \THEN that for choice of images with/without hidden text –  Jan 22 '19 at 15:55

0 Answers0