andismith / grunt-responsive-images

Produce images at different sizes for responsive websites.
http://www.andismith.com/grunt-responsive-images/
MIT License
719 stars 96 forks source link

Which quality should i choose for the image resize? #44

Closed rpkoller closed 10 years ago

rpkoller commented 10 years ago

The too huge image output got fixed like discussed in https://github.com/andismith/grunt-responsive-images/issues/41

But i have still troubles getting smaller output sizes, since i use the default quality value so far.

if i have a source image of 5mb with 4442px x 2961px and i use convert -quality '100' -resize '2000' directly inside the terminal the resulting file size is 2,8mb and 2000px x 1333px. if i use convert -resize '2000'the resulting file size is 1,2mb with 2000px x 1333px. With the following grunt settings

'user strict';
module.exports = function(grunt) {
 grunt.initConfig({
    responsive_images: {
     projects: {
        options: {
          engine: ['im'],
          sizes: [{
            name: "2000pro",
            width: 2000
          }],
          separator: ['_']
        },
        files: [{
          expand: true,
          src: ['projects/*.{jpg,gif,png}'],
          cwd: 'originals/',
          dest: 'img/'
        }]
      }
    }
  });
  grunt.loadNpmTasks('grunt-responsive-images');
  grunt.registerTask('default', ['responsive_images']);
};

the resulting image is 2,8mb with 2000px x 1333px. So is it possible that, per default, ImageMagick is using a quality of 100 for the grunt responsive images resize? Cuz shouldn't the output sizes for convert and grunt responsive image be identical if no quality is set and the default is used (the grunt output in the example above would also be 1,2mb instead of 2,8mb then).

On a side note, if i examine the resulting images in pixelmator, the images created with the grunt responsive image plugin have jfif attributes with a x and y density of 72 while the images created with convert, directly inside the terminal, have a x and y density of 300.

Best regards Ralf

andismith commented 10 years ago

Hi Ralf,

The quality of Grunt Responsive Images is set to 100 by default. Please specify quality value to change this.

Thanks, Andi

rpkoller commented 10 years ago

ahhhhh thanks Andi! I thought the default value for convert in the terminal would be the same like in the grunt ri plugin. But understood now. :) cool thanks!