Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Improve PNG optimization Gulp task

This is source PNG with transparency: http://i.imgur.com/7m0zIBp.png (13.3kB)

  • optimized using compresspng.com: http://i.imgur.com/DHUiLuO.png (5.4kB)
  • optimized using tinypng.com: http://i.imgur.com/rEE2hzg.png (5.6kB)
  • optimized with gulp-imagemin+imagemin-pngquant: http://i.imgur.com/OTqI6lK.png (6.6kB)

As you can see online tools are better than Gulp. Is there a way to improve PNG optimization with Gulp?

Just in case, here's my gulp task:

gulp.task('images', function() {
  return gulp.src('frontend/images/*')
    .pipe(imagemin({
      progressive: true,
      use: [pngquant()]
    }))
    .pipe(gulp.dest('public/images'));
});
like image 248
Limon Monte Avatar asked Mar 06 '15 10:03

Limon Monte


People also ask

How do I optimize an image using Gulp?

Declare Dependencies and Create Tasks var gulp = require('gulp'); var changed = require('gulp-changed'); var imagemin = require('gulp-imagemin'); Next, you need to create tasks for optimizing images as shown in the following code. gulp. task('imagemin', function() { var imgSrc = 'src/images/*.

Which plugin is used to compress Image file on gulp?

Use the imagemin-mozjpeg plugin, which has already been installed for you, to compress JPG images. Declare the imagemin-mozjpeg plugin by putting this line at the top your gulpfile. js .

What is default compression level in gulp Imagemin?

Answer. The compression level—0 is the lowest and 1 is the highest.


2 Answers

You can check out what the various algorithms have done by using ImageMagick's identify -verbose tool, like this

identify -verbose com.png    > com.txt
identify -verbose tin.png    > tin.txt
identify -verbose gulp.png   > gulp.txt

and then compare the outputs - I use opendiff on the Mac. You will see this if you compare com.txt (compresspng) versus gulp.txt

enter image description here

and this if you compare tiny (tinypng) versus gulp.txt

enter image description here

The difference is in the number of colours retained - gulp uses 94 colours, compresspng uses 66, and tiny uses 53.

In case you, or anyone else, wishes to compare any other aspects, I am pasting in the 3 outoput files below for reference:

gulp.txt

Image: gulp.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 560x290+0+0
  Units: Undefined
  Type: PaletteAlpha
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 8-bit
  Channel statistics:
    Pixels: 162400
    Red:
      min: 1 (0.00392157)
      max: 245 (0.960784)
      mean: 110.922 (0.434989)
      standard deviation: 104.067 (0.408106)
      kurtosis: -1.74946
      skewness: 0.208663
      entropy: 0.3477
    Green:
      min: 40 (0.156863)
      max: 245 (0.960784)
      mean: 124.973 (0.490091)
      standard deviation: 61.139 (0.239761)
      kurtosis: -1.32326
      skewness: 0.222376
      entropy: 0.330503
    Blue:
      min: 113 (0.443137)
      max: 244 (0.956863)
      mean: 170.131 (0.667179)
      standard deviation: 53.7786 (0.210897)
      kurtosis: -1.86628
      skewness: 0.233095
      entropy: 0.346704
    Alpha:
      min: 0 (0)
      max: 255 (1)
      mean: 197.075 (0.772845)
      standard deviation: 106.443 (0.417423)
      kurtosis: -0.298155
      skewness: 1.3014
      entropy: 0.157855
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 115.988 (0.454854)
      standard deviation: 84.8383 (0.332699)
      kurtosis: -0.730342
      skewness: 0.117783
      entropy: 0.295691
  Alpha: srgba(76,105,113,0)   #4C697100
  Colors: 94
  Histogram:
       660: (  1, 40,117,255) #012875 srgba(1,40,117,1)
         8: (  1, 58,131,255) #013A83 srgba(1,58,131,1)
         4: (  1, 66,138,255) #01428A srgba(1,66,138,1)
         6: (  1, 75,145,255) #014B91 srgba(1,75,145,1)
         2: (  1, 84,152,255) #015498 srgba(1,84,152,1)
         4: (  1, 93,159,255) #015D9F srgba(1,93,159,1)
         3: (  1,102,166,255) #0166A6 srgba(1,102,166,1)
         6: (  1,111,173,255) #016FAD srgba(1,111,173,1)
         4: (  1,119,180,255) #0177B4 srgba(1,119,180,1)
         4: (  1,128,187,255) #0180BB srgba(1,128,187,1)
         1: (  1,137,194,255) #0189C2 srgba(1,137,194,1)
        20: (  1,146,201,255) #0192C9 srgba(1,146,201,1)
         5: (  1,155,208,255) #019BD0 srgba(1,155,208,1)
         3: (  1,163,215,255) #01A3D7 srgba(1,163,215,1)
         5: (  1,172,222,255) #01ACDE srgba(1,172,222,1)
     59271: (  1,181,229,255) #01B5E5 srgba(1,181,229,1)
        91: (  1,181,229,143) #01B5E58F srgba(1,181,229,0.560784)
        80: (  1,181,229,224) #01B5E5E0 srgba(1,181,229,0.878431)
        79: (  1,181,229,  1) #01B5E501 srgba(1,181,229,0.00392157)
        66: (  1,181,229, 64) #01B5E540 srgba(1,181,229,0.25098)
        61: (  1,181,229, 16) #01B5E510 srgba(1,181,229,0.0627451)
        54: (  1,181,229, 36) #01B5E524 srgba(1,181,229,0.141176)
        50: (  1,181,229, 99) #01B5E563 srgba(1,181,229,0.388235)
        46: (  1,181,229,168) #01B5E5A8 srgba(1,181,229,0.658824)
        46: (  1,181,229,  9) #01B5E509 srgba(1,181,229,0.0352941)
        45: (  1,181,229,  4) #01B5E504 srgba(1,181,229,0.0156863)
        39: (  1,181,229,195) #01B5E5C3 srgba(1,181,229,0.764706)
        32: (  1,181,229, 25) #01B5E519 srgba(1,181,229,0.0980392)
        30: (  1,181,229,120) #01B5E578 srgba(1,181,229,0.470588)
        29: (  1,181,229, 80) #01B5E550 srgba(1,181,229,0.313725)
        29: (  1,181,229, 49) #01B5E531 srgba(1,181,229,0.192157)
         4: ( 15, 41,118,255) #0F2976 srgba(15,41,118,1)
        64: ( 16,185,230,255) #10B9E6 srgba(16,185,230,1)
         4: ( 30, 42,119,255) #1E2A77 srgba(30,42,119,1)
        40: ( 32,189,231,255) #20BDE7 srgba(32,189,231,1)
         3: ( 44, 43,119,255) #2C2B77 srgba(44,43,119,1)
        46: ( 47,193,232,255) #2FC1E8 srgba(47,193,232,1)
         7: ( 59, 44,120,255) #3B2C78 srgba(59,44,120,1)
       281: ( 62,197,233,255) #3EC5E9 srgba(62,197,233,1)
         3: ( 73, 45,121,255) #492D79 srgba(73,45,121,1)
     35876: ( 76,105,113,  0) #4C697100 srgba(76,105,113,0)
        29: ( 77,201,234,255) #4DC9EA srgba(77,201,234,1)
         1: ( 88, 46,122,255) #582E7A srgba(88,46,122,1)
        39: ( 93,205,235,255) #5DCDEB srgba(93,205,235,1)
         5: (102, 47,123,255) #662F7B srgba(102,47,123,1)
        24: (108,209,236,255) #6CD1EC srgba(108,209,236,1)
        18: (117, 48,124,255) #75307C srgba(117,48,124,1)
       267: (123,213,237,255) #7BD5ED srgba(123,213,237,1)
         3: (131, 49,124,255) #83317C srgba(131,49,124,1)
        27: (138,217,237,255) #8AD9ED srgba(138,217,237,1)
         2: (145, 50,125,255) #91327D srgba(145,50,125,1)
        28: (154,221,238,255) #9ADDEE srgba(154,221,238,1)
         4: (160, 51,126,255) #A0337E srgba(160,51,126,1)
        16: (169,225,239,255) #A9E1EF srgba(169,225,239,1)
        16: (174, 52,127,255) #AE347F srgba(174,52,127,1)
       202: (184,229,240,255) #B8E5F0 srgba(184,229,240,1)
        41: (199,233,241,255) #C7E9F1 srgba(199,233,241,1)
         2: (203, 54,128,255) #CB3680 srgba(203,54,128,1)
        43: (215,237,242,255) #D7EDF2 srgba(215,237,242,1)
         2: (216, 55,129,195) #D83781C3 srgba(216,55,129,0.764706)
         3: (218, 55,129,255) #DA3781 srgba(218,55,129,1)
        49: (230,241,243,255) #E6F1F3 srgba(230,241,243,1)
     53788: (232, 56,130,255) #E83882 srgba(232,56,130,1)
        77: (232, 56,130, 99) #E8388263 srgba(232,56,130,0.388235)
        72: (232, 56,130, 16) #E8388210 srgba(232,56,130,0.0627451)
        71: (232, 56,130,143) #E838828F srgba(232,56,130,0.560784)
        69: (232, 56,130,224) #E83882E0 srgba(232,56,130,0.878431)
        65: (232, 56,130, 64) #E8388240 srgba(232,56,130,0.25098)
        62: (232, 56,130,195) #E83882C3 srgba(232,56,130,0.764706)
        52: (232, 56,130, 36) #E8388224 srgba(232,56,130,0.141176)
        52: (232, 56,130,  4) #E8388204 srgba(232,56,130,0.0156863)
        52: (232, 56,130,  1) #E8388201 srgba(232,56,130,0.00392157)
        46: (232, 56,130,  9) #E8388209 srgba(232,56,130,0.0352941)
        34: (232, 56,130, 80) #E8388250 srgba(232,56,130,0.313725)
        33: (232, 56,130,168) #E83882A8 srgba(232,56,130,0.658824)
        27: (232, 56,130, 25) #E8388219 srgba(232,56,130,0.0980392)
        26: (232, 56,130,120) #E8388278 srgba(232,56,130,0.470588)
        22: (232, 56,130, 49) #E8388231 srgba(232,56,130,0.192157)
        57: (233, 68,137,255) #E94489 srgba(233,68,137,1)
        34: (234, 80,144,255) #EA5090 srgba(234,80,144,1)
        62: (234, 91,151,255) #EA5B97 srgba(234,91,151,1)
       402: (235,103,159,255) #EB679F srgba(235,103,159,1)
        51: (236,115,166,255) #EC73A6 srgba(236,115,166,1)
        35: (237,127,173,255) #ED7FAD srgba(237,127,173,1)
        34: (238,139,180,255) #EE8BB4 srgba(238,139,180,1)
        43: (239,151,187,255) #EF97BB srgba(239,151,187,1)
        44: (239,162,194,255) #EFA2C2 srgba(239,162,194,1)
        56: (240,174,201,255) #F0AEC9 srgba(240,174,201,1)
        38: (241,186,208,255) #F1BAD0 srgba(241,186,208,1)
        58: (242,198,216,255) #F2C6D8 srgba(242,198,216,1)
        41: (243,210,223,255) #F3D2DF srgba(243,210,223,1)
        53: (243,221,230,255) #F3DDE6 srgba(243,221,230,1)
        71: (244,233,237,255) #F4E9ED srgba(244,233,237,1)
      8841: (245,245,244,255) #F5F5F4 srgba(245,245,244,1)
  Rendering intent: Perceptual
  Gamma: 0.45455
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgba(223,223,223,1)
  Matte color: grey74
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 560x290+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2015-03-19T10:05:06+00:00
    date:modify: 2015-03-19T10:05:06+00:00
    png:cHRM: chunk was found (see Chromaticity, above)
    png:gAMA: gamma=0.45455 (See Gamma, above)
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 3
    png:IHDR.color_type: 3 (Indexed)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 560, 290
    png:PLTE.number_colors: 94
    png:sRGB: intent=0 (Perceptual Intent)
    png:tRNS: chunk was found
    signature: 91476421108f784ce82d392aa2e58bc6c8c5991cf6466f5db98809cc16f0f2ca
  Artifacts:
    filename: gulp.png
    verbose: true
  Tainted: False
  Filesize: 6.63KB
  Number pixels: 162K
  Pixels per second: 0B
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.0-10 Q16 x86_64 2015-03-10 http://www.imagemagick.org

tin.txt

Image: tin.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 560x290+0+0
  Units: Undefined
  Type: PaletteAlpha
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 8-bit
  Channel statistics:
    Pixels: 162400
    Red:
      min: 0 (0)
      max: 245 (0.960784)
      mean: 94.0738 (0.368917)
      standard deviation: 113.927 (0.446772)
      kurtosis: -1.82471
      skewness: 0.407541
      entropy: 0.400756
    Green:
      min: 0 (0)
      max: 245 (0.960784)
      mean: 101.679 (0.398739)
      standard deviation: 81.0101 (0.317687)
      kurtosis: -1.50733
      skewness: 0.171586
      entropy: 0.386438
    Blue:
      min: 0 (0)
      max: 244 (0.956863)
      mean: 145.019 (0.568702)
      standard deviation: 89.1803 (0.349727)
      kurtosis: -1.06731
      skewness: -0.563292
      entropy: 0.389441
    Alpha:
      min: 0 (0)
      max: 255 (1)
      mean: 197.073 (0.772837)
      standard deviation: 106.446 (0.417434)
      kurtosis: -0.298278
      skewness: 1.30136
      entropy: 0.179828
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 99.6745 (0.39088)
      standard deviation: 98.5213 (0.386358)
      kurtosis: -1.37999
      skewness: 0.35773
      entropy: 0.339116
  Alpha: none   #00000000
  Colors: 53
  Histogram:
     36007: (  0,  0,  0,  0) #00000000 none
       664: (  1, 40,117,255) #012875 srgba(1,40,117,1)
        12: (  1, 60,133,255) #013C85 srgba(1,60,133,1)
        12: (  1, 82,151,255) #015297 srgba(1,82,151,1)
        17: (  1,115,177,255) #0173B1 srgba(1,115,177,1)
        29: (  1,149,204,255) #0195CC srgba(1,149,204,1)
     59276: (  1,181,229,255) #01B5E5 srgba(1,181,229,1)
        95: (  1,181,229, 69) #01B5E545 srgba(1,181,229,0.270588)
        93: (  1,181,229, 19) #01B5E513 srgba(1,181,229,0.0745098)
        91: (  1,181,229,143) #01B5E58F srgba(1,181,229,0.560784)
        83: (  1,181,229, 40) #01B5E528 srgba(1,181,229,0.156863)
        80: (  1,181,229,224) #01B5E5E0 srgba(1,181,229,0.878431)
        50: (  1,181,229, 99) #01B5E563 srgba(1,181,229,0.388235)
        46: (  1,181,229,168) #01B5E5A8 srgba(1,181,229,0.658824)
        39: (  1,181,229,195) #01B5E5C3 srgba(1,181,229,0.764706)
        30: (  1,181,229,120) #01B5E578 srgba(1,181,229,0.470588)
        64: ( 16,185,230,255) #10B9E6 srgba(16,185,230,1)
         7: ( 36, 42,119,255) #242A77 srgba(36,42,119,1)
        86: ( 40,191,232,255) #28BFE8 srgba(40,191,232,1)
       281: ( 62,197,233,255) #3EC5E9 srgba(62,197,233,1)
        11: ( 65, 44,120,255) #412C78 srgba(65,44,120,1)
        68: ( 86,204,235,255) #56CCEB srgba(86,204,235,1)
        24: (108,209,236,255) #6CD1EC srgba(108,209,236,1)
        28: (118, 48,124,255) #76307C srgba(118,48,124,1)
       267: (123,213,237,255) #7BD5ED srgba(123,213,237,1)
       189: (133,121,180,  6) #8579B406 srgba(133,121,180,0.0235294)
        55: (146,219,238,255) #92DBEE srgba(146,219,238,1)
        22: (174, 52,127,255) #AE347F srgba(174,52,127,1)
       218: (183,229,240,255) #B7E5F0 srgba(183,229,240,1)
        84: (208,235,242,255) #D0EBF2 srgba(208,235,242,1)
        49: (230,241,243,255) #E6F1F3 srgba(230,241,243,1)
     53791: (232, 56,130,255) #E83882 srgba(232,56,130,1)
       103: (232, 56,130,104) #E8388268 srgba(232,56,130,0.407843)
        99: (232, 56,130, 18) #E8388212 srgba(232,56,130,0.0705882)
        87: (232, 56,130, 60) #E838823C srgba(232,56,130,0.235294)
        71: (232, 56,130,143) #E838828F srgba(232,56,130,0.560784)
        69: (232, 56,130,224) #E83882E0 srgba(232,56,130,0.878431)
        64: (232, 56,130,195) #E83882C3 srgba(232,56,130,0.764706)
        52: (232, 56,130, 36) #E8388224 srgba(232,56,130,0.141176)
        34: (232, 56,130, 80) #E8388250 srgba(232,56,130,0.313725)
        33: (232, 56,130,168) #E83882A8 srgba(232,56,130,0.658824)
        91: (234, 72,140,255) #EA488C srgba(234,72,140,1)
        62: (234, 91,151,255) #EA5B97 srgba(234,91,151,1)
       402: (235,103,159,255) #EB679F srgba(235,103,159,1)
        51: (236,115,166,255) #EC73A6 srgba(236,115,166,1)
        35: (237,127,173,255) #ED7FAD srgba(237,127,173,1)
        77: (239,146,184,255) #EF92B8 srgba(239,146,184,1)
        44: (239,162,194,255) #EFA2C2 srgba(239,162,194,1)
        56: (240,174,201,255) #F0AEC9 srgba(240,174,201,1)
        96: (242,194,213,255) #F2C2D5 srgba(242,194,213,1)
        94: (243,217,227,255) #F3D9E3 srgba(243,217,227,1)
        71: (244,233,237,255) #F4E9ED srgba(244,233,237,1)
      8841: (245,245,244,255) #F5F5F4 srgba(245,245,244,1)
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgba(223,223,223,1)
  Matte color: grey74
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 560x290+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2015-03-19T10:04:55+00:00
    date:modify: 2015-03-19T10:04:55+00:00
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 3
    png:IHDR.color_type: 3 (Indexed)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 560, 290
    png:PLTE.number_colors: 53
    png:sRGB: intent=0 (Perceptual Intent)
    png:tRNS: chunk was found
    signature: f7e69fb1d6be1bde229a91d820f0f42330b923a37e28f0fccb181fdd6485c81c
  Artifacts:
    filename: tin.png
    verbose: true
  Tainted: False
  Filesize: 5.59KB
  Number pixels: 162K
  Pixels per second: 0B
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.0-10 Q16 x86_64 2015-03-10 http://www.imagemagick.org

com.txt

Image: com.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 560x290+0+0
  Units: Undefined
  Type: PaletteAlpha
  Endianess: Undefined
  Colorspace: sRGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 8-bit
  Channel statistics:
    Pixels: 162400
    Red:
      min: 1 (0.00392157)
      max: 245 (0.960784)
      mean: 110.909 (0.434937)
      standard deviation: 104.021 (0.407927)
      kurtosis: -1.74831
      skewness: 0.209362
      entropy: 0.377289
    Green:
      min: 40 (0.156863)
      max: 245 (0.960784)
      mean: 124.952 (0.490008)
      standard deviation: 61.1171 (0.239675)
      kurtosis: -1.32134
      skewness: 0.22372
      entropy: 0.367959
    Blue:
      min: 113 (0.443137)
      max: 244 (0.956863)
      mean: 170.07 (0.66694)
      standard deviation: 53.7829 (0.210913)
      kurtosis: -1.86532
      skewness: 0.235003
      entropy: 0.37823
    Alpha:
      min: 0 (0)
      max: 255 (1)
      mean: 197.074 (0.772839)
      standard deviation: 106.445 (0.417433)
      kurtosis: -0.298201
      skewness: 1.30139
      entropy: 0.169804
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 115.964 (0.454761)
      standard deviation: 84.8218 (0.332635)
      kurtosis: -0.729488
      skewness: 0.118667
      entropy: 0.32332
  Alpha: srgba(76,105,113,0)   #4C697100
  Colors: 66
  Histogram:
       664: (  1, 40,117,255) #012875 srgba(1,40,117,1)
        12: (  1, 60,133,255) #013C85 srgba(1,60,133,1)
        12: (  1, 82,151,255) #015297 srgba(1,82,151,1)
        17: (  1,115,177,255) #0173B1 srgba(1,115,177,1)
        29: (  1,149,204,255) #0195CC srgba(1,149,204,1)
     59276: (  1,181,229,255) #01B5E5 srgba(1,181,229,1)
        91: (  1,181,229,143) #01B5E58F srgba(1,181,229,0.560784)
        91: (  1,181,229,  6) #01B5E506 srgba(1,181,229,0.0235294)
        86: (  1,181,229, 32) #01B5E520 srgba(1,181,229,0.12549)
        80: (  1,181,229,224) #01B5E5E0 srgba(1,181,229,0.878431)
        66: (  1,181,229, 64) #01B5E540 srgba(1,181,229,0.25098)
        61: (  1,181,229, 16) #01B5E510 srgba(1,181,229,0.0627451)
        50: (  1,181,229, 99) #01B5E563 srgba(1,181,229,0.388235)
        46: (  1,181,229,168) #01B5E5A8 srgba(1,181,229,0.658824)
        39: (  1,181,229,195) #01B5E5C3 srgba(1,181,229,0.764706)
        30: (  1,181,229,120) #01B5E578 srgba(1,181,229,0.470588)
        29: (  1,181,229, 49) #01B5E531 srgba(1,181,229,0.192157)
        29: (  1,181,229, 80) #01B5E550 srgba(1,181,229,0.313725)
        64: ( 16,185,230,255) #10B9E6 srgba(16,185,230,1)
        40: ( 32,189,231,255) #20BDE7 srgba(32,189,231,1)
        46: ( 47,193,232,255) #2FC1E8 srgba(47,193,232,1)
        17: ( 52, 43,120,255) #342B78 srgba(52,43,120,1)
       281: ( 62,197,233,255) #3EC5E9 srgba(62,197,233,1)
     36007: ( 76,105,113,  0) #4C697100 srgba(76,105,113,0)
        29: ( 77,201,234,255) #4DC9EA srgba(77,201,234,1)
        39: ( 93,205,235,255) #5DCDEB srgba(93,205,235,1)
        24: (108,209,236,255) #6CD1EC srgba(108,209,236,1)
        27: (115, 48,124,255) #73307C srgba(115,48,124,1)
       267: (123,213,237,255) #7BD5ED srgba(123,213,237,1)
        27: (138,217,237,255) #8AD9ED srgba(138,217,237,1)
        44: (160,223,239,255) #A0DFEF srgba(160,223,239,1)
        22: (169, 51,127,255) #A9337F srgba(169,51,127,1)
       202: (184,229,240,255) #B8E5F0 srgba(184,229,240,1)
        41: (199,233,241,255) #C7E9F1 srgba(199,233,241,1)
         5: (212, 54,129,255) #D43681 srgba(212,54,129,1)
        43: (215,237,242,255) #D7EDF2 srgba(215,237,242,1)
         2: (216, 55,129,195) #D83781C3 srgba(216,55,129,0.764706)
        49: (230,241,243,255) #E6F1F3 srgba(230,241,243,1)
     53788: (232, 56,130,255) #E83882 srgba(232,56,130,1)
        99: (232, 56,130, 18) #E8388212 srgba(232,56,130,0.0705882)
        98: (232, 56,130,  6) #E8388206 srgba(232,56,130,0.0235294)
        77: (232, 56,130, 99) #E8388263 srgba(232,56,130,0.388235)
        71: (232, 56,130,143) #E838828F srgba(232,56,130,0.560784)
        69: (232, 56,130,224) #E83882E0 srgba(232,56,130,0.878431)
        65: (232, 56,130, 64) #E8388240 srgba(232,56,130,0.25098)
        62: (232, 56,130,195) #E83882C3 srgba(232,56,130,0.764706)
        52: (232, 56,130, 36) #E8388224 srgba(232,56,130,0.141176)
        34: (232, 56,130, 80) #E8388250 srgba(232,56,130,0.313725)
        33: (232, 56,130,168) #E83882A8 srgba(232,56,130,0.658824)
        26: (232, 56,130,120) #E8388278 srgba(232,56,130,0.470588)
        22: (232, 56,130, 49) #E8388231 srgba(232,56,130,0.192157)
        57: (233, 68,137,255) #E94489 srgba(233,68,137,1)
        34: (234, 80,144,255) #EA5090 srgba(234,80,144,1)
        62: (234, 91,151,255) #EA5B97 srgba(234,91,151,1)
       402: (235,103,159,255) #EB679F srgba(235,103,159,1)
        51: (236,115,166,255) #EC73A6 srgba(236,115,166,1)
        69: (238,133,177,255) #EE85B1 srgba(238,133,177,1)
        43: (239,151,187,255) #EF97BB srgba(239,151,187,1)
        44: (239,162,194,255) #EFA2C2 srgba(239,162,194,1)
        56: (240,174,201,255) #F0AEC9 srgba(240,174,201,1)
        38: (241,186,208,255) #F1BAD0 srgba(241,186,208,1)
        58: (242,198,216,255) #F2C6D8 srgba(242,198,216,1)
        41: (243,210,223,255) #F3D2DF srgba(243,210,223,1)
        53: (243,221,230,255) #F3DDE6 srgba(243,221,230,1)
        71: (244,233,237,255) #F4E9ED srgba(244,233,237,1)
      8841: (245,245,244,255) #F5F5F4 srgba(245,245,244,1)
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Background color: white
  Border color: srgba(223,223,223,1)
  Matte color: grey74
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 560x290+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Zip
  Orientation: Undefined
  Properties:
    date:create: 2015-03-19T10:04:45+00:00
    date:modify: 2015-03-19T10:04:45+00:00
    png:IHDR.bit-depth-orig: 8
    png:IHDR.bit_depth: 8
    png:IHDR.color-type-orig: 3
    png:IHDR.color_type: 3 (Indexed)
    png:IHDR.interlace_method: 0 (Not interlaced)
    png:IHDR.width,height: 560, 290
    png:PLTE.number_colors: 66
    png:sRGB: intent=0 (Perceptual Intent)
    png:tRNS: chunk was found
    signature: 4fe0f71265e48080cff87d20e1ddb116af764c8429df9e1ef2b1460aeaf6b6a6
  Artifacts:
    filename: com.png
    verbose: true
  Tainted: False
  Filesize: 5.41KB
  Number pixels: 162K
  Pixels per second: 0B
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.9.0-10 Q16 x86_64 2015-03-10 http://www.imagemagick.org
like image 136
Mark Setchell Avatar answered Nov 11 '22 07:11

Mark Setchell


I've spend a lot of time implementing and designing compression algorithms, so let me give a partial answer - although it is probably not what you want to hear.

If you read on how the compression of png file format works, f.ex. here, you will find out that it uses Deflate compression along with a predictor. Deflate compression is a lossless compression algorithm - and even though you can implement it with better or worse compression, I would assume that most implementations will produce roughly the same result in terms of compression level. Nowadays most people don't bother implementing deflate anymore, so the compression itself probably won't do you any good.

The way tools like the one you linked work is by mapping RGB colors to indexed colors. If you have only a limited number of colors (say, 256), you can convert your image to an indexed representation and save it again. Less colors means less information to encode, which means that your compression level is going up. If your image uses only a few colors, or if you're willing to loose information, this can be an option.

Knowing what to look for, I think you can do the same trick in just about any image package, which includes such as f.ex. ImageMagick, Gimp. (In Gimp f.ex. you can do image -> mode -> indexed and save again with all options off).

like image 6
atlaste Avatar answered Nov 11 '22 06:11

atlaste