Dithering in PNG files?

Ask other users about problems encountered with portable apps or help by posting solutions to existing problems.
Post Reply
Message
Author
User avatar
webfork
Posts: 9784
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Dithering in PNG files?

#1 Post by webfork » Mon Nov 24, 2014 5:04 pm

Does anyone know of a portable program that does what paint.net does in terms of dithering on PNG files?

The idea is that the gradients in a given image don't turn into separate, distinct blocks but instead still blend somewhat and produce low file sizes. RIOT tends to do the blocky thing (which you may have seen in several of my screencaps) where Paint.NET does the smooth, dithering thing.

See below for a screencap of the Paint.NET dialog on this:

Image

User avatar
SYSTEM
Posts: 1969
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

Re: Dithering in PNG files?

#2 Post by SYSTEM » Tue Nov 25, 2014 1:19 am

webfork wrote: The idea is that the gradients in a given image don't turn into separate, distinct blocks but instead still blend somewhat and produce low file sizes.
:?: Dithering hurts compression ratio really badly. If you want gradients to blend, just use enough colors. If not, let gradients turn into blocks.
My YouTube channel | Release date of my 13th playlist: August 24, 2020

User avatar
webfork
Posts: 9784
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Re: Dithering in PNG files?

#3 Post by webfork » Sat Dec 06, 2014 9:05 pm

Are you sure? I just ran a standard test (random screenshot) in Paint.NET using 8-bit color and mid-range dithering that came out to only 34k where if I bumped up to 24-bit color, the file size goes up to 63k. Is dithering really that bad?

User avatar
SYSTEM
Posts: 1969
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

Re: Dithering in PNG files?

#4 Post by SYSTEM » Sat Dec 06, 2014 11:30 pm

webfork wrote:Are you sure? I just ran a standard test (random screenshot) in Paint.NET using 8-bit color and mid-range dithering that came out to only 34k where if I bumped up to 24-bit color, the file size goes up to 63k. Is dithering really that bad?
Okay, I ran a test as well. I captured a screenshot when I viewed your post and saved it as PNG with Snipping Tool. The file was 253 kilobytes large and contained 19 435 colors.

Then I converted the picture to indexed color mode. I converted it with GIMP. I let it generate optimized palette of 255 colors and turned dithering off. The resulting file was 64 kilobytes.

Finally, I converted the original picture to indexed color mode again. Again, I used GIMP and allowed it to generate an optimized palette of 255 colors. This time I used Floyd-Steinberg dithering. The resulting file size was 546 kilobytes, i.e. over twice as large as the original picture!
My YouTube channel | Release date of my 13th playlist: August 24, 2020

User avatar
webfork
Posts: 9784
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Re: Dithering in PNG files?

#5 Post by webfork » Fri Dec 26, 2014 5:46 pm

SYSTEM wrote:Then I converted the picture to indexed color mode. I converted it with GIMP. I let it generate optimized palette of 255 colors and turned dithering off. The resulting file was 64 kilobytes.
Okay I'll recheck using GIMP. Thanks for testing.

romulous
Posts: 76
Joined: Fri Feb 25, 2011 5:51 pm

Re: Dithering in PNG files?

#6 Post by romulous » Fri Dec 26, 2014 7:55 pm

SYSTEM wrote:Then I converted the picture to indexed color mode. I converted it with GIMP. I let it generate optimized palette of 255 colors and turned dithering off. The resulting file was 64 kilobytes.

Finally, I converted the original picture to indexed color mode again. Again, I used GIMP and allowed it to generate an optimized palette of 255 colors. This time I used Floyd-Steinberg dithering. The resulting file size was 546 kilobytes, i.e. over twice as large as the original picture!
Unless you have jumbled up your units (eg kilobits vs kilobytes), my math skills tell me that 546/64=8. Technically, you are correct in saying that is over twice as large, but your are understating it quite a bit.

User avatar
SYSTEM
Posts: 1969
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

Re: Dithering in PNG files?

#7 Post by SYSTEM » Sat Dec 27, 2014 2:46 am

romulous wrote:
SYSTEM wrote:Then I converted the picture to indexed color mode. I converted it with GIMP. I let it generate optimized palette of 255 colors and turned dithering off. The resulting file was 64 kilobytes.

Finally, I converted the original picture to indexed color mode again. Again, I used GIMP and allowed it to generate an optimized palette of 255 colors. This time I used Floyd-Steinberg dithering. The resulting file size was 546 kilobytes, i.e. over twice as large as the original picture!
Unless you have jumbled up your units (eg kilobits vs kilobytes), my math skills tell me that 546/64=8. Technically, you are correct in saying that is over twice as large, but your are understating it quite a bit.
I said "over twice as large as the original picture" which was 253 kilobytes large.
My YouTube channel | Release date of my 13th playlist: August 24, 2020

romulous
Posts: 76
Joined: Fri Feb 25, 2011 5:51 pm

Re: Dithering in PNG files?

#8 Post by romulous » Sat Dec 27, 2014 3:16 am

Fair enough, I thought the whole point of the exercise was to compare dithered (546KB) vs non-dithered (64KB). I was mistaken obviously.

User avatar
SYSTEM
Posts: 1969
Joined: Sat Jul 31, 2010 1:19 am
Location: Helsinki, Finland

Re: Dithering in PNG files?

#9 Post by SYSTEM » Sat Dec 27, 2014 6:31 am

romulous wrote:Fair enough, I thought the whole point of the exercise was to compare dithered (546KB) vs non-dithered (64KB). I was mistaken obviously.
Not the whole point, just a part of the point.

There are three options regarding image quality and file size:
  • 24-bit colors: highest quality, but relatively large
  • indexed colors, not dithered: lowest quality, but also smallest file size
  • indexed colors, dithered: quality somewhere in between. Also relatively large.
Dithering would be okay if "indexed colors, dithered" wasn't too much larger than "indexed colors, not dithered". However, at least with my particular test sample it was way too large.

It only added an insult to the injury that "indexed colors, dithered" was also larger than "24-bit colors" with my test sample. Dithering that picture makes no sense at all, because the original picture is both smaller and of higher quality.
My YouTube channel | Release date of my 13th playlist: August 24, 2020

romulous
Posts: 76
Joined: Fri Feb 25, 2011 5:51 pm

Re: Dithering in PNG files?

#10 Post by romulous » Sat Dec 27, 2014 5:50 pm

Right, now I understand :)
SYSTEM wrote:It only added an insult to the injury that "indexed colors, dithered" was also larger than "24-bit colors" with my test sample.
Now that causes my eyebrow to raise! Would never have predicted that - would have always went for the 'full 24bit will always be larger' option.

Post Reply