• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to install jpegoptim and optipng in Linux

{{postValue.id}}

jpegoptim and optipng in Linux

In this article we will discuss about how to install the jpegoptim which is a utility tool to optimize/compress JPEG files without loosing its original quality and OptiPNG is a small program which helps to optimize PNG images to smaller size without losing information.

To Install jpegoptim

On Debian and its Derivatives

apt-get install jpegoptim
or
sudo apt-get install jpegoptim

On RedHat based Systems
You need to install and enable EPEL repository On RPM based systems like RHEL, CentOS, Fedora etc.,

yum install epel-release

On Fedora 22+ versions

dnf install epel-release

Next install jpegoptim program from the repository
yum install jpegoptim

On Fedora 22+ versions
dnf install jpegoptim

Installation

[root@linuxhelp ~]# yum install jpegoptim
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
&hellip 
&hellip 
&hellip 
===========================================================================
 Package            Arch            Version               Repository     Size
===========================================================================
Installing:
 jpegoptim          x86_64          1.4.3-1.el6           epel           27 k

Transaction Summary
===========================================================================
Install       1 Package(s)

Total download size: 27 k
Installed size: 53 k
Is this ok [y/N]: y
...
...
...
...
Installed:
  jpegoptim.x86_64 0:1.4.3-1.el6                                              
Complete

Now the Installation is completed.

Syntax of jpegoptim

jpegoptim [options] filename.jpeg

Now Let’ s Compress the language.jpg image using jpegoptim command and before that we can find out the actual size of the image using du command.

Example

[root@linuxhelp Desktop]# du -sh language.jpg
12K    language.jpg 
[root@linuxhelp Desktop]# jpegoptim language.jpg
language.jpg 18x21 24bit N Exif IPTC XMP Adobe JFIF [ok] 8490 -->  8068 bytes (4.9%),  optimized
[root@linuxhelp Desktop]# du -sh language.jpg
8.0k   language.jpg

You can compress the given image to a specific size to, but it won’ t damage the actual picture density.

[root@linuxhelp Desktop]# du -sh image.jpg 
684k   image.jpg
[root@linuxhelp Desktop]# jpegoptim --size=200k image.jpg
image.jpg 2082x2975 24bit N Adobe JFIF [ok] 69661 -->  205079 bytes (70.56%),  optimized
[root@linuxhelp Desktop]# du -sh image.jpg
204k   image.jpg

jpegoptim is also Possible to compress multiple png images.

To install Opti PNG

To install Opti PNG on your Linux systems, run the following command from your terminal.

On Debian and it' s Derivatives

apt-get install optipng
or
sudo apt-get install optipng

On RedHat based Systems
# yum install optipng

On Fedora 22+ versions
# dnf install optipng

You must have epel repository enabled on your RHEL/CentOS based systems to install opti png program.

Installation

[root@linuxhelp Desktop]# yum install optipng
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: centos.excellmedia.net
 * epel: mirror.wanxp.id
 * extras: centos.excellmedia.net
 * updates: centos.excellmedia.net
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
-->  Running transaction check
--->  Package opti png.x86_64 0:0.6.4-1.el6 will be installed
-->  Finished Dependency Resolution
...
...
...
...
Installed:
  opti png.x86_64 0:0.6.4-1.el6                                                                      

Complete!

OptiPNG Image Optimizer

Syntax

optipng filename.png
optipng [options] filename.png

Now Let’ s Compress the image1.png image using optipng command and before that we can find out the actual size of the image using du command.

Example

[user1@linuxhelp Desktop]$ du -sh image1.png
280k   image1.png

[user1@linuxhelp Desktop]$ optipng image1.png
Opti PNG 0.6.4: Advanced PNG optimizer.
Copyright (C) 2001-2010 Cosmin Truta.

** Processing: image1.png
519x600 pixels, 3x8 bits/pixel, RGB
Input IDAT size = 284820 bytes
Input file size = 284973 bytes

Trying:
  zc = 9  zm = 8  zs = 0  f = 0        IDAT size = 284202
  zc = 9  zm = 8  zs = 0  f = 5        IDAT size = 183140
                               
Selecting parameters:
  zc = 9  zm = 8  zs = 0  f = 5        IDAT size = 183140

Output IDAT size = 183140 bytes (101680 bytes decrease)
Output file size = 183197 bytes (101776 bytes = 35.71% decrease)

[user1@linuxhelp Desktop]$ du -sh image1.png
180k   image1.png

optipng is also Possible to compress multiple png images.

Tags:
owen
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

any gui tool for compression of image for ubuntu?

A

yes there is try Trimage install using the command "sudo apt-get install trimage"

Q

Is there a linux command to bulk optimize several image files in just one step?

A

Its best recommended to use ImageMagick

Q

What is the best picture compression tool?

A

gimp,pngcrush , optipng, trimage are the Picture compression tool

Q

What is the command to install jpegoptim on centos 7?

A

The command to install jpegoptim on centos 7 is

#yum install jpegoptim

Q

What is the syntax of OptiPNG Image Optimizer?

A

the syntax of OptiPNG Image Optimizer is

optipng filename.png
optipng [options] filename.png

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Lucas ?
Various options in Top command

Am using Top command only to view the load average, what are the various options in Top command..??

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.