Blogroll

Powered by Blogger.

Monday 14 July 2014

Command to Reduce File Size and Dimensions of Images in Ubuntu

by realfinetime  |  in Ubuntu at  12:45

          Photography is always amazing. Pictures captured using certain cameras will be of large file size. If such images are used in websites, it will take long time to completely load the website. To improve the loading speed, reducing the file size of these images is important. Reducing the quality of image will reduce the file memory size. Similarly, if you want to display images as thumbnails, it is better to reduce the dimensions of image. So reduction of quality as well as dimensions of an image will reduce the file size considerably. Many methods are there to reduce the file size and dimensions of images in windows and linux.


          Most of the image editing softwares have an option to reduce the quality and dimensions of image. But, if you have to do the same process for a lot of images, it will be time consuming as well as irritating. If there is a method to do the same process for a set of images using a single command, how much simple will be the process! In linux this process can be done using a simple command.

          Open terminal and enter to the directory in which images are saved using cd command. My images are stored in Pictures folder in the Home folder.

cd Pictures/



          Now run the following command to resample the images to 36% size and 30% quality of the original images.

convert *.png -resample 36 -quality 30% -set filename:orig %t  edited%[filename:orig].png



          This command will resample all the png images and will create new images. Name of this edited image will have an "edited" prefix infront of it's original name as shown in the following screenshot.

A comparison between these two images is given in the following screenshot.


          Size of gsm.png ( Original image ) is 543*357 pixels and the file size is 317.1 kB. But the size of editedgsm.png ( Edited image ) is 272*179 pixels and file size is 111kB.

          If you want to edit jpg files, .png must be replaced by .jpg in the command. Conversion of images from png to jpg and jpg to png is also possible by this method.

1 comment:

  1. You'll just have to pay a fraction of the regular rate to make international calls, and in many countries, receiving calls while abroad won't cost you a dime. People used to shop for local prepaid Roaming IoT SIM Card when they traveled, but this becomes difficult if you plan on visiting more than one foreign nation. Someone may be calling your old number even after you've left the country.

    ReplyDelete

IMPORTANT NOTICE

All the circuits, published in this blog is only after testing and getting proper results in my private lab. When you try these circuits, you should check the supply voltage, polarity of components, presence of childrens nearby and shorts in the circuits. This website will not be responsible for any harm happened to you or your components caused by your carelessness.

For More Electronic Tips



Blog Archive

Proudly Powered by Blogger.