Showing posts with label image. Show all posts
Showing posts with label image. Show all posts

Thursday, September 17, 2009

Resize image using Imagemagick

Imagemagick is a powerful image manipulation program. This tutorial is about resizing image with Imagemagick.

Resize an image to 500px width.
mogrify -resize 500 image.png

Resize an image to 500x300, with aspect ratio preserved.
mogrify -resize 500x300 image.png

Force resize an image to 500x300.
mogrify -resize 500x300! image.png

Resize multiple images.
mogrify -resize 500x300 *.png

Monday, May 25, 2009

How to insert very large image/figure in LaTeX

To insert a very large image in LaTeX, use the textwidth command to stretch the image.

0.75\textwidth meant 75% of the text width.

Tuesday, April 22, 2008

Insert figures to LaTeX

LaTeX is a good tool for creating articles or books. However, when it comes to inserting figures, it is a very cumbersome process. This tutorial will show the steps for producing LaTeX documents with figures. For the purpose of this tutorial, we will use a graph from an excel document.

Step 1: Highlight (left click) the graph in the excel file.

Step 2: Copy the graph into memory. Right click and select Copy. (or just press and hold Ctrl, and then press c)

Step 3: Open Paint application. Click on the Start button, choose All Programs > Accessories > Paint.

Step 4: Paste the graph that we have just copied into Paint. Click on Edit > Paste. (or just press and hold Ctrl, and then press v)

Step 5: Now we are going to save our graph in JPEG format. Click File > Save As. A "Save As" dialog box will opened. Type the file name - graph. For the "Save as type" choose JPEG. For simplicity, make sure that the graph is saved in the save folder as the LaTeX document. Then, click on the save button.

Step 6: Open the LaTeX document, and type the following LaTeX code:
\caption{Some graph}
Don't forget to import the graphicx package, by inserting
at the top of the LaTeX document.

Step 7: Now we can produce the pdf document, using the pdflatex command.

note: This tutorial assumed that we are going to produce a pdf file, since pdflatex only accept PDF, PNG, JPEG and GIF format. For producing a postscript or dvi file, we need to convert the JPEG file (graph.jpg) to eps format. It could be done using tools such as jpeg2ps. However, it is beyond this tutorial.