4 ms·
What about dithering for the smallest possible images? I'm talking in the 300 byte - 2kb range here. Does anyone have any suggestions for what to do to really g
by owenversteeg 6y ago
What about dithering for the smallest possible images? I'm talking in the 300 byte - 2kb range here. Does anyone have any suggestions for what to do to really get file size down?
- dassurma 6y agoAuthor here! I don’t think many people have researched or optimized on this, but I also work on https://squoosh.app https://squoosh.app, and from that experience I know that dithering makes compression _worse_ most of the time (unless you use PNG and use a super small palette of colors). Interesting idea tho!
- deleted 6y ago[deleted]
- shadowfaxRodeo 6y agoHi Surma! fantastic article. You can save a lot of data switching to a lossless format as you said, and especially when using ordered dithering. Even if the color palette is quite large. Error diffusion causes problems for certain color palettes, but usually results in a smaller image size. I've made a tool for doing this: https://doodad.dev/dither-me-this https://doodad.dev/dither-me-this, you can easily half the size of a jpeg by dithering it and exporting it as a png.
- mattdesl 6y agoQuantizing to <= 256 colors will let you use a single byte per pixel, but there are other techniques like Block Truncation Coding that work well with 8bit images to go down to 2 bits per pixel or lower. Even at 2 bits per pixel, this is still quite big as raw data, so you typically will want to use compression on top such as RLE, DEFLATE, etc. I’m currently exploring this for my own applications, compressing large 8bit sprite sheet images, and it’s producing much smaller images than most palette based image formats (GIF, WebP, PNG, etc). Follow my progress here: https://twitter.com/mattdesl/status/1346048282494177280?s=21 https://twitter.com/mattdesl/status/1346048282494177280?s=21
- kccqzy 6y agoI did use dithering for unimportant background images of a website. Use just 256 colors, and both PNG and GIF will use a color palette instead of describing each pixel separately. Really helps with the file size. Afterwards muck with the various lossless compression parameters in PNG with optipng to shave off a few more percent.
- steerablesafe 6y agopngquant is a FOSS tool designed for that. https://pngquant.org/ https://pngquant.org/