Image manipulation: What are the options?

What manipulations on imported images can be done from inside LaTeX?

Using the graphicx package, I can

• Change image width and height
• Rotate image by a given angle
• Crop image
• Select specific page in image file (e.g., in a multi-page PDF)

Are the other more advanced options? Things I would find useful include flipping an image, rendering it as B/W, or controlling resolution?

Can I call an external program to do more advanced manipulation from LaTeX?

-

As Matthew pointed out the complete list of options is listed in the Graphics Guide (grfguide), i.e. the manual of the graphicx package. Similar effects can be achieved using the macros provided by this package, i.e. \scalebox, \resizebox, etc. There is also the adjustbox package which provides the missing \clipbox and \trimbox as well as the general \adjustbox macro which accepts all \includegraphics options and applies it to general text.

However, all effects are applied to the original image as part of the rendering done by the viewer software. The image is still included in its original form. You shouldn't see the package as an image manipulation tool. Rendering it as B/W might be possible as some PDF commands, but graphicx doesn't include such. Also the resolution is not affected. Both should be done using an external image manipulation software.

Flipping an image is possible. Try scale=-1. If you only want to have it flipped in the X- or Y- coordinate you need to place the \includegraphics command inside a \scalebox which accepts an extra optional argument. There is also \reflectbox{...} which is the same as \scalebox{-1}[1]{...}. Unfortunately, \includegraphics doesn't support that directly.

-
So \includegraphics really just attaches the original image file to the LaTeX output (e.g. PDF) and adds appropriate parameters in the output to tell the viewer (e.g. Acrobat) how to display the image (e.g. [completely made up] -crop_bottom=75%) ? –  Frank Seifert May 12 '11 at 19:14
@Frank: Basically yes. Images are stored as binary objects and IMHO similar to attachments. The PDF format allows a series of operations on the displayed objects. This includes scaling, cropping, rotation and similar operations. So with pdflatex the graphicx package (more precisely its pdftex driver) inserts the image as it is and adds the correct PDF operations to it. These are part of the PDF format/standard and viewers must support them to display the PDF correctly. –  Martin Scharrer May 13 '11 at 13:52
@Frank: If you crop a large image so that only a small part is shown then the whole image is included and can be extracted from the PDF. In fact, I wrote once a JPG recovery tool which looked for the JPG specific binary start and end markers in the unused space of the hard drive and it undeleted JPGs from deleted PDFs! The JPG files are really added unchanged in their original format! –  Martin Scharrer May 13 '11 at 13:56

Take a look at the manual to the graphics bundle. It's called grfguide.pdf and if you have a command line you can probably call it up by typing "texdoc graphicx". It's also on CTAN.

-