I have a Google Docs drawing that is a small scheme. However, this small scheme is surrounded by a lot of background that occupies a lot of useless space.
I do not want to remove the background manually because I may need the extra space in the future.
I know Latex has a lot of image packages, so I was wondering if there is some package that I can use to automatically detect that useless background and crop my image so I do not have all that white space around it.
I know some of you will suggest the external tool pdfcrop. I have experimented with it, but it does not crop the image at all.
Here is the png image file and here is the pdf version downloaded with Gdocs.
Best Answer
You do not need a cropped copy with a external program, only add some options to
\includegraphics
. This MWE show the same image twice (renamed toimage.png
) , with and without the useless background. Both images are inside a framed box to show the edges:Edit: Since the goal seem to be the automatic cropping more that avoid a cropped copy, this has been perfectly solved in the comments (with an external tool) as far I know, so only put in practice to in a MWE.
The following code with a poorman's macro added to the above MWE:
Will produce this image automatically:
Really the cropping was not make really by LaTeX and neeed one extra file, but who cares? Anyway is done while running
pdflatex
.