Skip to content →

WordPress image quality and size

Share on FacebookShare on Google+Tweet about this on TwitterShare on VKShare on TumblrPin on Pinterest

To change generated image quality use the following code:

  add_filter('jpeg_quality', function($arg){return 80;});

If a problem with minifying – also using of plugins like https://wordpress.org/plugins/wp-smushit/ is recomended

For detecting image quality ImageMagick could be used:

# yum install ImageMagick.x86_64
# identify -verbose CA0002-1-204x160.jpg
Image: CA0002-1-204x160.jpg
  Format: JPEG (Joint Photographic Experts Group JFIF format)
  Class: DirectClass
  Geometry: 204x160+0+0
  Resolution: 72x72
  Print size: 2.83333x2.22222
  Units: PixelsPerInch
  Type: TrueColor
  Endianess: Undefined
  Colorspace: RGB
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
  Channel statistics:
    Red:
      min: 14 (0.054902)
      max: 255 (1)
      mean: 218.905 (0.858452)
      standard deviation: 49.2991 (0.19333)
      kurtosis: -0.115958
      skewness: -1.00308
    Green:
      min: 13 (0.0509804)
      max: 255 (1)
      mean: 218.695 (0.857629)
      standard deviation: 49.4865 (0.194065)
      kurtosis: -0.142898
      skewness: -0.993778
    Blue:
      min: 11 (0.0431373)
      max: 255 (1)
      mean: 219.786 (0.861904)
      standard deviation: 47.917 (0.18791)
      kurtosis: -0.132297
      skewness: -0.988068
  Image statistics:
    Overall:
      min: 11 (0.0431373)
      max: 255 (1)
      mean: 219.129 (0.859328)
      standard deviation: 48.9059 (0.191788)
      kurtosis: -0.12572
      skewness: -0.996289
  Rendering intent: Undefined
  Interlace: None
  Background color: white
  Border color: rgb(223,223,223)
  Matte color: grey74
  Transparent color: black
  Compose: Over
  Page geometry: 204x160+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: JPEG
  Quality: 90
  Orientation: Undefined
  Properties:
    date:create: 2015-11-08T02:29:20+02:00
    date:modify: 2015-11-08T02:29:20+02:00
    jpeg:colorspace: 2
    jpeg:sampling-factor: 1x1,1x1,1x1
    signature: a940ce5a3f82fc8ae13a1eec334389466c2052dd14384b761646c12d1bda8f0c
  Artifacts:
    verbose: true
  Tainted: False
  Filesize: 5.63KBB
  Number pixels: 32.6KB
  Pixels per second: 326.4TB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 6.7.2-7 2015-07-23 Q16 http://www.imagemagick.org

Quality: 90 is the answer.

Share on FacebookShare on Google+Tweet about this on TwitterShare on VKShare on TumblrPin on Pinterest

Published in dev IT wordpress