![]() You can use the ‘ !’ symbol with the resolution to tell ImageMagick that the resolution has to be maintained strictly. So if the resolution that you specify doesn’t maintain the original aspect ratio of the image, ImageMagick will use a resolution which is close to what you specified while maintaining the aspect ratio.īut this default behaviour is easy to override. I say close to that resolution because by default, ImageMagick tries to maintain the aspect ration. You’ll have a new image called output_file.jpg whose resolution is somewhere close to 1024x768 pixels. If you want to reduce that to say around 1024x768 pixels, you just do it like this: convert image.jpg -resize 1024x768 output_file.jpgĪnd that’s it. And therefore, the command is also pretty simple to understand and remember, even for a non-techie.Ĭonsider we have an image called image.jpg which is around 2816x2112 pixels, that’s like a 6MP image. This is I think one of the most basic image manipulation we’d do. So the commands given below are all tested on Ubuntu (16.04 to be precise). One more thing, I work with Ubuntu - my personal laptop runs Ubuntu, my work laptop runs Ubuntu, my personal AWS EC2 instance runs Ubuntu, and almost all of the cloud computers I work on run Ubuntu. Before you read any further, if you are not aware of ImageMagick and the features it offers, go through their website first.Īlso, I’d like to point out that this is more for personal reference, so that after a few months when I forget the commands or need to manipulate more images, I can come back here and get all the commands I need. I wrote the script in PHP and ImageMagick was the weapon of choice. Recently I got the opportunity to work on a project where a lot of images had to be manipulated - changing the resolution and keeping the file size in check. In this post, I’m going to list out a few of the commands which come in very handy in a variety of situations. If you’re not sure what ImageMagick is, it’s one of the greatest tools you could have on your computer, to manipulate images and a few other types of files.
0 Comments
Leave a Reply. |