Optimize PNG and JPEG images using imgopt for SEO and Website Speed

Installing requirements
This package is required for building Debian packages.
$ sudo apt-get install build-essential  

This package contains programs for manipulating JPEG files from the libjpeg-turbo JPEG library:

* cjpeg/djpeg: convert to/from the JPEG file format
* rdjpgcom/wrjpgcom: read/write comments in JPEG files
* jpegtran: lossless transformations of JPEG files
* jpegexiforient/exifautotran: manipulate EXIF orientation tag
* tjbench: a simple JPEG benchmarking tool

$ sudo apt-get install libjpeg-turbo-progs

Fix; attempt to correct a system with broken dependencies in place. This option, when used with install/remove, can omit any packages to permit APT to deduce a likely solution. If packages are specified, these have to completely correct the problem. The option is sometimes necessary when running APT for the first time; APT itself does not allow broken package dependencies to exist on a system. It is possible that a system's dependency structure can be so corrupt as to require manual intervention (which usually means using dpkg--remove to eliminate some of the offending packages). Use of this option together with -m may produce an error in some situations.

Configuration Item: APT::Get::Fix-Broken.

$ sudo apt-get install -f
OptiPNG is a PNG optimizer that recompresses the image files to a smaller size. It losslessly reduces the bit depth, the color type and the color palette of the image, runs a suite of compression methods and strategies, and selects the compression parameters that yield the smallest output file. It also recognizes several external file formats like BMP, GIF, TIFF and PNM (PBM, PGM, PPM).

$ sudo  apt-get install optipng

This is the GNU C compiler, a fairly portable optimizing compiler for C. This is a dependency package providing the default GNU C compiler.

$ sudo apt-get install gcc

Trimage is a cross-platform GUI and command-line interface to optimize image files for websites, using optipng, pngcrush, advpng and jpegoptim, depending on the filetype (currently, PNG and JPG files are supported). It was inspired by imageoptim. All image files are losslessy compressed on the highest available compression levels, and EXIF and other metadata is removed. Trimage gives you various input functions to fit your own workflow: A regular file dialog, dragging and dropping and various command line options.

$ sudo apt-get install trimage

Install IMGOPT script

Download IMGOPT here

imgopt is ready to run. Copy imgopt into your path and chmod it executable.

i.e. as root or via sudo:

$ sudo cp imgopt /usr/local/bin/ && chmod a+x /usr/local/bin/imgopt
Compile jfifremove and copy into your path. i.e.:

$ sudo gcc -o jfifremove jfifremove.c
Copy or move into the path:
$ sudo mv jfifremove /usr/local/bin/
if you would rather not use jfifremove and just leave JFIF data intact, you can edit the imgopt script and delete/comment out the line that calls jfifremove.
imgopt [FILE/DIR] [FILE/DIR] [FILE/DIR] ...
Optimizes any combination of files and directories. Directories are searched recursively, and all image files in any subdirectories are optimized.

% sudo imgopt .  Optimize all images in current directory and any subdirectories # imgopt *.png Optimize all pngs in current directory only.
The script is perfect for web masters for optimizing images for SEO and Website Speed Tests.

Font size: +
Report Print

By accepting you will be accessing a service provided by a third-party external to https://www.klokur.com/