I was wanting to test out the imagemin-contrib
in Grunt.js
. I selected three jpg
random images (sizes: 44kb, 92kb, 77kb, respectively) and set up the folder and plugin.
When I ran the imagemin
grunt task, I received a message saying the photos were optimized successfully, but the numbers showed only a 5kb or 10kb reduction in size for the first two photos, and the third wasn't changed at all.
I was wondering if this was normal for an "optimized image"? I was expecting a more drastic drop in size. Could it be that the images I selected were simply already optimized? Or could it be in how I have written the grunt command?
Below is the code I used to execute the grunt command:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
//Image Min Plugin
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'photos/',
src: ['**/*.{png,jpg,gif}'],
dest: 'photos/optim/'
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.registerTask('default', ['imagemin']);
};