Outline of this page
ImageMagick's command which I sometimes use are shown in this page.
ImageMagick's command which I sometimes use are shown in this page.
mogrify -format jpg *.png
All png files in a directory are converted into jpeg files with that same filename but a different suffix. Original png files are maintained if same name file doesn't exist.
mogrify -trim -density 300 -bordercolor "#ffffff" -border 50x50 -format png *.eps
All eps files in a directory are converted into png files with that same filename but a different suffix. In this case, first, margin is deleted by '-trim', and next, margin of 50x50 with white color is added. Resolution of image is specified in 300 dpi by '-desity 300.'
mogrify -rotate 90 -trim -density 300 -bordercolor "#ffffff" -border 50x50 -format png *.ps
All ps files in a directory are converted into png files with that same filename but a different suffix. Images are rotated by the angle of 90 degree. This is necessary procedure for treating ps file.
convert "*.gif" -resize 120x120 thumnail%03d.png
All gif files in a directory are resized in maximum size of 120x120, and file types are changed into png and filenames are changed with 3 digits sequence number such as thumnail000.png, thumnail001.png...
convert fig_org.png -resize x200 fig_cnv.png
File 'fig_org.png' in a direcrory is resized in the vertical size of 200, and it is saved as the name of 'fig_cnv.png'. Horizontal size of the image is changed automatically with same aspect ratio.
convert "*.gif" -crop 120x50+10+5 thumnail%03d.png
All gif files in a directory are trimmed with size of H120xV50. Starting point for trimming is x=10 and y=5. And file types are changed into png and filenames are changed with 3 digits sequence number .
convert -density 300 fig_inp.eps fig_out.png
eps file is converted into png file. Since default resolution is 72 dots per inch, if '-density' is not specified, clean image can not be obtained. So, in this case, '-density 300' (w x h =300x300) is specified.
identify fig_inp.png
In case of getting size of image, 'identify' can be used.
If you want to write information in file, following command can be used. In this case, result will be written in file 'test.txt.'
identify fig_inp.png > test.txt
If you want to know detailed information, add '-verbose' after 'identify' command.
identify -verbose fig_inp.png
convert -size 1500x1050 xc:"#ffffff" base.png
convert -size 1500x1050 canvas:"#f0e68c" base.png
File 'base.png' with size of 155x1050 is created. In this case, 'xc' of 'canvas' cam be used To specify the color. To specify the color, not only hexadecimal but also color name can be used.
composite -gravity center fig_inp.png base.png fig_out_base.png
By putting 'fig_inp.png' over 'base.png', superimposed image 'fig_out_base.png' can be obtained.
In case of using 'convert', following command are used.
convert base.png fig_inp.png -composite fig_out_base.png
convert -trim -density 300 fig_inp.eps fig_out.png
png image deleted white margin can be obtain using '-trim.' In this case, resolution of png image is specified in 300 dpi by '-density 300.'
convert fig_out.png -bordercolor "#ffffff" -border 50x50 fig_out_bd.png
White color margin with width of 50 dots in each direction of left, right, top and bottom is added to file fig_out.png. So, fig_out_bd.png can be obtained.
Following command gives the same result as above except border color.
convert -bordercolor "#f5deb3" -border 50 fig_out.png fig_out_bd.png
mogrify -trim -density 300 -bordercolor "#ffffff" -border 50x50 -format png *.eps mogrify -resize 600x -unsharp 2x1.4+0.5+0 -quality 100 *.png
First, all eps files in a directory are converted into png files with that same filename but a different suffix. Next, the sizes of all png files are changed what have the width of 600 pixels and have same filenames as eps files. These commands are convenient when those png files are put into html document.