Image Manipulation

In a recent blog article I used WordPress to embed images into a posting. This was very simple to do but there is a drawback: The image embedded within the post is identical in size and resolution to the one viewed if the image hyperlink is clicked. This makes the post and initial webpage very bulky to view.

I could solve this by copying the images to a PC with a GUI, manipulating them to create thumbnails and then copying them back again, not exactly a slick process. My solution is to use ImageMagick tools.

Convert JPEG to PNG
convert image.jpg image.png

Resize by percentage
convert image.png -resize 50% newimage.png

Resize to fixed size
convert image.png -resize 240×240 newimage.png
The above command does not change the image ratio, it just best-fits the existing ratio within the boundaries of the box defined by -resize.

Rotate by 90 degress
convert image.png -rotate 90 newimage.png
To rotate 90 degrees anti-clockwise use -rotate -90.

Leave a comment