I wonder, but couldn't find an existing answer to that.
So I want to crop an image and then resize it to fit the page width.
I get two errors Missing number, treated as zero. {img.png}
and Illegal unit of measure (pt inserted). {img.png}
(both referring to line y).
Output seems to be okay (also cropped and resized).
At first, I thought it was because of line x, because of that, it is split up like that over 3 lines. It works when I comment out before the word "trim", but I need that. Line x was double checked against different sources but I couldn't find an error.
\usepackage[pdftex]{graphicx}
%...
\begin{figure}[h]
% h (here) - same location
\centering
\includegraphics[trim=(0pt 30pt 0pt 0pt),% line x
clip=true,width=\linewidth]
{img.png} % line y, Error reported to be here
\end{figure}
To the comment: You're probably right and it is more obvious to do resizing and cropping seperately. But it is well defined: (Quoting Martin Scharrer from Crop an inserted image?)
Note that all scaling/resizing is applied after the trimming. If you want the original image be scaled to 5cm width and then 50% clipped, just resize the clipped half to a width of 2.5cm afterwards