Automatically resize images on A4 in LaTeX

I have many photos, the size of which is very different from the image to the picture.

I want to develop an algorithm that allows you to remove extra spaces. Such algorithms are used in signal processing when removing excess noise, for example, in mobile phones.

The algorithm should be used as follows

 \includegraphics[crop-redundant-whitespace]{picture.png} 

The function crop-redundant-whitespaceshould change the include-command, for example,

 \includegraphics[width=2.5cm, height=5.0cm]{picture.png}

Algorithm should

  • detect parts of at least 2 cm in length that are separated from each other.
  • if there are many large parts, then a large part should be chosen.

How can you automatically resize images and fix them on A4?

+3
4

epstopdf. pdfcrop PDF , :

\documentclass{article}
\usepackage{graphicx,epstopdf}
\DeclareGraphicsRule{.pdf}{pdf}{-crop.pdf}{`pdfcrop #1}
\begin{document}
\fbox{\includegraphics[scale=0.5]{essai}}% => change this to a real PDF
\end{document}

, - TeX Live 2009; , , .

, , , . .

+1

LaTeX; , , , , LaTeX.

, ImageMagick - , , LaTeX.

+2

:

\documentclass[a4paper]{article}

\begin{document}
\resizebox{\textwidth}{\textheight}{\includegraphics*{compatible_image_file}}
\end{document}

. "!", . \rotatebox , / .

\includegraphics :

\includegraphics[width=\textwidth, height=\textheight]{compatible_image_file}

, , , , 15 . bog-o-tricks...

marginddling , , . slides. , .

+1

, .

\newcommand{\adjustimg}{% Horizontal adjustment of image
  \ifodd\value{page}\hspace*{\dimexpr\evensidemargin-\oddsidemargin}\else\hspace*{-\dimexpr\evensidemargin-\oddsidemargin}\fi%
}
\newcommand{\centerimg}[2][width=\textwidth]{% Center an image
  \makebox[\textwidth]{\adjustimg\includegraphics[#1]{#2}}%
}

\begin{document}
\mbox{} \par
\noindent\centerimg[width=\paperwidth,height=\paperheight]{tiger}

: , , , , , ( ) - . .

Info

0

Source: https://habr.com/ru/post/1713753/


All Articles