• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

pngcrush for image optimization

by admin

Last time we talked about jpegoptim, jpegtran and optipng. Today we’re going to talk about pngcrush – an optimizer for PNG (Portable Network Graphics) files. pngcrush can be run from a command line in an MSDOS window, or from a UNIX or LINUX command line.

Installation of pngcrush

On Debian, this utility is included in packages:

# apt-get install pngcrush

Usage of pngcrush

For maximum compression without loss of quality use this command to compress a png file as much as possible:

# pngcrush -rem alla -rem text -reduce -brute in.png out.png

during this action, in.png file will be optimized and the result saved in out.png

Parameters

1. A simple option for automatic optimization:

# pngcrush -reduce -brute in.png out.png

2. Also, pngcrush can remove all color correction data from a file:

# pngcrush -rem gAMA -rem cHRM -rem iCCP -rem sRGB in.png out.png

3. Data that supported may also be deleted:

# pngcrush -rem alla -rem text in.png out.png

Optimization of all pictures in a folder

For maximum optimization of all images in a folder, use the following command:

for file in * .png
do 
    pngcrush -reduce -brute -rem alla -rem gAMA -rem cHRM -rem iCCP -rem sRGB "$ file" "$ {file% .png} -crushed.png" && mv "$ {file% .png} -crushed .png "" $ file "
done

Filed Under: Linux

Some more articles you might also be interested in …

  1. Extend the Size of /boot Partition on XFS Filesystem (CentOS/RHEL 7)
  2. How to increase swap space on Linux
  3. How to Restrict Active Directory Users and Groups to Login to CentOS/RHEL 7 Client
  4. Invalid ABI Option abi=aapcs-linux
  5. How to Enable Disk Quotas on an XFS File System
  6. CentOS / RHEL : How to Enable SSL For Apache
  7. How to Install Gnome Desktop Environment onto Oracle Linux 6.x
  8. “Volume “myvg/vol01″ Is Not Active Locally” – CentOS/RHEL
  9. CentOS / RHEL : How to setup session idle timeout (inactivity timeout) for ssh auto logout
  10. CentOS / RHEL 7 : How to modify the kernel command line

You May Also Like

Primary Sidebar

Recent Posts

  • vgextend Command Examples in Linux
  • setpci command – configure PCI device
  • db_load command – generate db database
  • bsdtar command – Read and write tape archive files

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright