selaux / node-sprite-generator

Generates image sprites and their spritesheets (css, stylus, sass or less) from sets of images. Supports retina sprites. Provides express middleware and grunt task.
MIT License
192 stars 39 forks source link

JPG support with quality option #76

Open l0co opened 5 years ago

l0co commented 5 years ago

Why have you removed JPG support? I use jimp composer and in 0.10.2 I can still render image to JPG just by using filename with .jpg extension, but in master I can see there's forced PNG support only (even for .jpg extension a PNG-format file is rendered).

It's useful to have an option to choose the format. For example in my project the example sprite file sizes are:

  1. PNG = 4.7 MB
  2. JPG = 2.6 MB (quality: 100)
  3. JPG = 0.9 MB (quality: 90)

There's no visible quality decrease for these pictures (source images are anyway JPG-s with 90 quality) so I'd like to choose 3rd option with the smallest file.

Also, for 0.10.2 there's no option to provide JPG quality, which I've provided additionally here https://github.com/l0co/node-sprite-generator/commit/7fcd13f70bb7d35b56d112f629e600450d16ef8f