[pdf] Resize a picture in the command line using ImageMagick (convert) and save it as a PDF
Resize a picture or PDF file by 50% of its original form and save it as a PDF:
$ convert rose.jpg -resize 50% rose.pdf
Well, ‘convert’ may be used to convert between most of the known image formats —- not just JPG and PDF!
N.B. 1. More options may be found at the ImageMagick website. More information on how to specify the geometry may be found here. (If you don’t have ImgeMagick you need to install it first — see the first link for more information on installation!).
2. Here is a list of other useful options/ examples on how to make the best out of ‘convert’.
3. If you’re at playing with PDFs you may also be interested in joining and removing pages from a PDF document using Ghostscript — see a previous post here.
[latex] Multiple figures under the same caption using ``subfigure''
If you want to put several small figures under the same caption, then you need to include the subfigure (along with graphicx) package. The format is something like this:
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents of main.tex (LaTeX Source)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%% Preamble %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\documentclass[11pt,a4paper]{article}
\usepackage{graphicx, subfigure}
%
%%%%%%%%% The Document starts here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\begin{document}
%
Some random text at the beginning of the document ........
%%
% -------------- Include the figures as follows -------------------%
%%
\begin{figure}[ht!]
\begin{center}
%
\subfigure[Caption of First Figure]{%
\label{fig:first}
\includegraphics[width=0.4\textwidth]{FirstFigure}
}%
\subfigure[Caption of Second Figure]{%
\label{fig:second}
\includegraphics[width=0.4\textwidth]{SecondFigure}
}\\ % ------- End of the first row ----------------------%
\subfigure[Caption of Third Figure]{%
\label{fig:third}
\includegraphics[width=0.4\textwidth]{ThirdFigure}
}%
\subfigure[Caption of Fourth Figure]{%
\label{fig:fourth}
\includegraphics[width=0.4\textwidth]{FourthFigure}
}%
%
\end{center}
\caption{%
The l-o-n-g caption for all the subfigures
(FirstFigure through FourthFigure) goes here.
}%
\label{fig:subfigures}
\end{figure}
%%
% -------------- End of figure environment ----------------------%
%%
The first, second, third and the fourth subfigures in Figure
\ref{fig:subfigures} are labeled as
\ref{fig:first}, \ref{fig:second}, \ref{fig:third} and \ref{fig:fourth},
respectively.
Some more text before the end ..........
%
\end{document}
%
%%%%%% The End %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
It will create two rows of subfigures with two subfigures on each row (needless to say, you must have all those figures, viz. FirstFigure.eps through FourthFigure.eps, in the same directory as the LaTeX source file). The optional argument within the square brackets immediately following the subfigure statement is the caption of the subfigure (besides the main caption for all the subfigures at the end).
Various other options (e.g., cropping, resizing are rotating the figures) for includegraphics were explained awhile ago.
Reference: here.
[latex] Crop, resize and rotate figures in LaTeX
First of all, make sure to include the graphicx package in the preamble of your LaTeX source file. The following command exemplifies how to crop, resize and rotate figures in LaTeX.
\begin{figure}[h]
\centering
\includegraphics[trim=1cm 2cm 3cm 4cm, clip=true, totalheight=0.5\textheight, angle=90]{figure}
\caption{The caption goes here}
\end{figure}Needless to say, the above goes in between begin{document} and end{document} statements.
Let’s explain the various parts in the argument of \includegraphics command:
- Cropping: “
trim=1cm 2cm 3cm 4cm” trims (crops) from left, bottom, right and top by 1, 2, 3 and 4cm respectively. It must be accompanied by “clip=true”. - Resizing: “
totalheight=0.5\textheight” will force the figure to occupy 50% of the page length-wise keeping the aspect ratio constant. - Rotating: “
angle=90” rotates the figure by 90 degrees.
Reference: For more options, refer to this.

leave a comment