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

Performance improvement to gm.identify by adding format #93

Closed benurb closed 9 years ago

benurb commented 9 years ago

Hello there,

today we had a problem in one of our projects, because the grunt task was running way too long (about 7 minutes). We investigated the case and found out that most of the time it was running grunt-responsive-images and in specific gm identify -verbose -ping image.jpg. After reading a bit further I found out, that this is caused by node-gm, because no format option was given to image.identify() (which is highly recommended according to their docs). So, I added a format option that returns the image format, the delay between images and the number of scenes. This is the current way of identifying if the image is an animated gif or not. For us the results after this patch where the following: Number of pictures: 17 Size: 7-8 MB (16 MPixel) Number of configs: 3 (so 51 resizes in total) Time without the patch: 5 minutes 40 seconds Time with the patch: 1 minute 16 seconds

Feedback would be appreciated since I'm no im/gm expert, so I don't know if there's a better way to do this (especially without the string splitting magic).

Regards, Ben

andismith commented 9 years ago

Amazing, thank you!