+ Post New Thread
Results 1 to 2 of 2

Thread: If possible lossless web image compression - image optimization ?

  1. #1
    Fli
    Fli is offline
    Administrator Fli's Avatar
    Join Date
    Mar 2013
    Posts
    2,535

    If possible lossless web image compression - image optimization ?



    Hello,

    is there any way to compress website image (jpg, png. gif) the way it dont loose any quality but still is maximum compressed?
    I want to optimise my website images, preferrably from linux command line

    I tried to install Trimage (does png and jpg) but unsuccessfully on CentOS, it had many large dependencies to install:How to install Trimage on Linux?

    Then i installed "JpegOptim" (does jpg, jpeg) (yum install jpegoptim or apt-get install jpegoptim) then lossless compress image .jpg ...
    command "jpegoptim image.jpg"

    Code:
    image.jpg 250x250 24bit N Exiff XMP IPTC  [OK] 53345 --> 53379 bytes (-0.06%), skipped.


    So almost no reduction in that image case, if one want to really compress images (85% quality), then use: "jpegoptim -m85image.jpg".
    For optimizing all .jpg images recursivelly:

    Code:
    find /home/myusername/public_html -type f -iname "*.jpg" -exec jpegoptim -m85 {} \;


    Here is more detailed info about JPEG lossless optimization & compression: Compress JPG images losslessly into JPEG Progressive?

    Then i installed OptiPNG (does .png) (yum install optipng or apt-get install optipng).
    This is an example of almost lossless png optimization: (optipng -o0 image.png)
    Good png compression while keeping quality practically same: (optipng -o2 image.png)
    For optimizing all .png images recursivelly:

    Code:
    find /home/myusername/public_html -type f -iname "*.png" -exec optipng -o2 -preserve {} \; -exec chown OWNERUSERNAME:OWNERUSERNAME {} \;


    (in case you are logged in as root and the website username is other, optipng will change file owner to root, so at the end we do chown)
    Alternative to OptiPNG for lossless optimization can be "PngOut"

    Then i installed "GifSicle" (does .gif) (yum install gifsicle or apt-get install gifsicle)
    Low loss gif optimization: gifsicle -b -O1 orig-animation.gif -o new-animation.gif
    Bigger gif optimization: gifsicle -b -O2 orig-animation.gif -o new-animation.gif
    If that command result in error "gifsicle: image.gif: not a GIF image", then try jpegoptim on it..

    i did this command to optimize all .gif recursivelly:

    Code:
    find /home/myusername/public_html -type f -iname "*.gif" -exec gifsicle -b -O2 {} \;


    -- SUMMARY: Trimage is not good for server use, its not in default repos. jpegoptim is in repos and optipng too. So i would use JpegOptim for jpg optimization/compression and OptiPng for png optimization/compression.


    Need to bulk optimize several types of images on server recursivelly? Check this Linux shell script

  2. #2
    Junior Member GridCash's Avatar
    Join Date
    Mar 2018
    Posts
    5


    Is this useful / helpfull? Yes | No
    TinyPNG is a very good online tool for PNG compression

+ Post New Thread

Similar Threads

  1. What is Image Tag..?
    By jsharma in forum SEO - Search Engine Optimisation
    Replies: 5
    Last Post: 03-07-2019, 08:45 AM
  2. What Is Image Optimization In Seo..?
    By jsharma in forum SEO - Search Engine Optimisation
    Replies: 0
    Last Post: 08-03-2018, 06:35 AM
  3. How to do search engine image optimization..?
    By swatijain2233 in forum SEO - Search Engine Optimisation
    Replies: 3
    Last Post: 02-28-2018, 12:03 PM
  4. Image upload site, upload image from clipboard?
    By Fli in forum Computers & Technology
    Replies: 1
    Last Post: 02-26-2014, 10:25 PM
  5. Replies: 0
    Last Post: 04-18-2013, 09:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
 Protected by : ZB BLOCK  &  StopForumSpam