How to Optimize and Compress JPEG or PNG Images in Linux Commandline

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.95/month).
  4. Become a Supporter - Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Senthil Kumar

A Linux Consultant, living in India. He loves very much to write about Linux, Open Source, Computers and Internet. Apart from that, He'd like to review Internet tools and web services.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

22 Responses

  1. Florian says:

    Very nice! Does the batch operation work recursively?

  2. yunik maharjan says:

    when I run the command I get something like this:

  3. cloud consulting says:

    Type the following command:

    $ apt-get install jpegoptim
    

    Sample outputs:—-

    [sudo] password for vivek: 
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
    libavutil-extra-51 libggiwmh0-target-x libggi2 libgii1 libvo-aacenc0
    libgii1-target-x mplayer-skin-blue libggiwmh0 libggi-target-x
    libvo-amrwbenc0
    Use 'apt-get autoremove' to remove them.
    The following NEW packages will be installed:
    jpegoptim
    0 upgraded, 1 newly installed, 0 to remove and 5 not upgraded.
    Need to get 14.0 kB of archives.
    After this operation, 77.8 kB of additional disk space will be used.
    Get:1 http://mirror.anl.gov/debian/ squeeze/main jpegoptim amd64 1.2.3-2+b1 [14.0 kB]
    Fetched 14.0 kB in 1s (11.2 kB/s)    
    Selecting previously deselected package jpegoptim.
    (Reading database ... 333683 files and directories currently installed.)
    Unpacking jpegoptim (from .../jpegoptim_1.2.3-2+b1_amd64.deb) ...
    Processing triggers for man-db ...
    Setting up jpegoptim (1.2.3-2+b1) ...
    
  4. lovet says:

    Finally, I have been looking for such tools for image optimization on Linux. Until now, i have always required intenet for image optimizations. Thanks for the post.

  5. David B. says:

    Hello, just wanted to thank you for the article. I needed a way to optimize my images to pass google’s pagerank and this helped immensely. Once again thanks for the easy to read tutorial.

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *