Dithering from 16 bit to 8 bit

Here everybody can post his problems with PhotoLine
Juan
Mitglied
Posts: 596
Joined: Thu 06 Oct 2011 08:08

Dithering from 16 bit to 8 bit

Post by Juan » Tue 01 Sep 2020 11:07

Hi all,

I have noticed a heavy dithering in my images when I convert them from 16 bit or 32 bit to 8 bit color depth. Is there a way to prevent this dithering?

Cheers,
Juan

User avatar
der_fotograf
Mitglied
Posts: 360
Joined: Mon 05 Dec 2016 08:33

Re: Dithering from 16 bit to 8 bit

Post by der_fotograf » Tue 01 Sep 2020 16:56

If you use this tool, you won't have any dithering:

Screen Shot 2020-09-01 at 16.52.34.png
You do not have the required permissions to view the files attached to this post.
--------------------------------------------
Nur wenige wissen, wie viel man wissen muss, um zu wissen, wie wenig man weiss.
— Werner Heisenberg

User avatar
Gerhard Huber
Entwickler
Entwickler
Posts: 3800
Joined: Mon 18 Nov 2002 15:30
Location: Bad Gögging

Re: Dithering from 16 bit to 8 bit

Post by Gerhard Huber » Tue 01 Sep 2020 17:05

I think it depends on the setting of the antialias switch.
But without dithering, you will get banding. Be aware that quality of 8 Bit images is not so good as 16 or 32 bit.
You do not have the required permissions to view the files attached to this post.

Juan
Mitglied
Posts: 596
Joined: Thu 06 Oct 2011 08:08

Re: Dithering from 16 bit to 8 bit

Post by Juan » Tue 01 Sep 2020 17:30

der_fotograf wrote:
Tue 01 Sep 2020 16:56
If you use this tool, you won't have any dithering:


Screen Shot 2020-09-01 at 16.52.34.png
That's what I use and it give me the dithering.
Gerhard Huber wrote:
Tue 01 Sep 2020 17:05
I think it depends on the setting of the antialias switch.
But without dithering, you will get banding. Be aware that quality of 8 Bit images is not so good as 16 or 32 bit.
The problem is that I can't send to my customers a 16bit picture, since they are just plain people with paint and windows picture viewer installed only.

So before converting the picture to 8 bit should I deactivate anti-alias?

User avatar
shijan
Mitglied
Posts: 360
Joined: Mon 23 Dec 2019 15:21

Re: Dithering from 16 bit to 8 bit

Post by shijan » Tue 01 Sep 2020 17:44

I just checked few generated test gradients, converted from 16 to 8 bit in PrhotoLine and in other apps, and both look near the same. Both apps add some small amount of noise (dithering) to 8 bit image to avoid banding artefacts.
Can you provide your 16 bit source image?
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302

Juan
Mitglied
Posts: 596
Joined: Thu 06 Oct 2011 08:08

Re: Dithering from 16 bit to 8 bit

Post by Juan » Tue 01 Sep 2020 18:26

shijan wrote:
Tue 01 Sep 2020 17:44
I just checked few generated test gradients, converted from 16 to 8 bit in PrhotoLine and in other apps, and both look near the same. Both apps add some small amount of noise (dithering) to 8 bit image to avoid banding artefacts.
Can you provide your 16 bit source image?
Thank you for checking it with other programs. Sadly, this current project is under NDA and I can't share anything yet. I guess when I deliver it I will ask the client if I can share it.

It could be that since the image has a little bit of noise, this gets "overhauled" by the dithering?

User avatar
shijan
Mitglied
Posts: 360
Joined: Mon 23 Dec 2019 15:21

Re: Dithering from 16 bit to 8 bit

Post by shijan » Tue 01 Sep 2020 18:40

You may just crop small part where you see dithering. Or do a PNG screenshot of zoomed part before and after bit depth transform. No one just can't tell you any solution without seeing actual example of problem. Maybe it is not a dithering but something else...
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302

User avatar
shijan
Mitglied
Posts: 360
Joined: Mon 23 Dec 2019 15:21

Re: Dithering from 16 bit to 8 bit

Post by shijan » Tue 01 Sep 2020 18:44

By the way, dinthering and banding may be just due color management on your system or due display calibration ICC profile, at least due image ICC profile itself. Try to inspect final exported image in different viewer, different system or different monitor...
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302

User avatar
der_fotograf
Mitglied
Posts: 360
Joined: Mon 05 Dec 2016 08:33

Re: Dithering from 16 bit to 8 bit

Post by der_fotograf » Tue 01 Sep 2020 19:00

The »Antialias« settings are kind of confusing. You can enable the antialias in the panel, but in the »Document« settings it still is set to »Default«.

Screen Shot 2020-09-01 at 18.57.19.png
You do not have the required permissions to view the files attached to this post.
--------------------------------------------
Nur wenige wissen, wie viel man wissen muss, um zu wissen, wie wenig man weiss.
— Werner Heisenberg

Juan
Mitglied
Posts: 596
Joined: Thu 06 Oct 2011 08:08

Re: Dithering from 16 bit to 8 bit

Post by Juan » Tue 01 Sep 2020 20:50

Thank you all for pitching it here :D

I tried many combinations with no avail.

Here is a really tiny piece of the image in 16bit, I hope that there is a missing thing in my workflow so I can fix it.
https://1drv.ms/u/s!AoMv8bCdXlOdxj-KZS3 ... f?e=rUAYuD

Cheers,
Juan

User avatar
Herbert123
Mitglied
Posts: 1919
Joined: Sat 12 May 2012 21:38

Re: Dithering from 16 bit to 8 bit

Post by Herbert123 » Tue 01 Sep 2020 21:35

That is a rendered image, correct? The dark areas contain a lot of noise. Before converting to a lower bit depth, I would suggest rendering either more samples or using the built-in denoiser in your 3d app, or both.

As it stands, there is just too much noise in the shadows in that render. It is going to throw off conversions later on in the pipeline.
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait

User avatar
Herbert123
Mitglied
Posts: 1919
Joined: Sat 12 May 2012 21:38

Re: Dithering from 16 bit to 8 bit

Post by Herbert123 » Tue 01 Sep 2020 22:19

Update.

I opened your EXR in Blender's compositor, denoised it, and saved it. Opened in PhotoLine, and converted to 8bit.

It was a tad surprising: no matter whether I converted with or without anti-aliasing, the result was pretty terrible. Very noisy and awful dithering in the dark wood. It does not matter if I turn anti-aliasing on or off.

To double-check, I used Blender to save a 8bit and 16 bit PNG. The result: visible noise due to rendering as expected in the shadows, but it is acceptable as a whole.

It seems PhotoLine interprets this file wrong, and adds a humongous amount of unnecessary dithering. Even the denoised 32bit exr version from Blender gets mangled by extreme dithering. Again: it does not matter if anti-aliasing is active or not.

I think this is a bug. When I use the Web Export option, the EXR 32bit image looks as expected when I pick PNG output. Even an 8bit 256 colour version looks much better than the 24bit converted version in the viewport! This really must some sort of bug.

And one other thing that I noticed: when opening the file in PhotoLine, and switching off anti-aliasing, the grey border area displayed slightly visible blocks. When I turn on anti-aliasing, the grey border area is dithered! (my picture mode edge area colour is set to #5e5e5e)
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait

User avatar
Herbert123
Mitglied
Posts: 1919
Joined: Sat 12 May 2012 21:38

Re: Dithering from 16 bit to 8 bit

Post by Herbert123 » Tue 01 Sep 2020 22:25

Workaround for now: export your 16/32bit EXR as a PNG file via Web Export. This generates a usable 8bit conversion. Do not reduce the bit depth in the Layer properties to 8bit, and continue to work in either 32bit or 16 bit.
/*---------------------------------------------*/
System: Win10 64bit - i7 920@3.6Ghz, p6t Deluxe v1, 48gb (6x8gb RipjawsX), Nvidia GTX1080 8GB, Revodrive X2 240gb, e-mu 1820, 2XSamsung SA850 (2560*1440) and 1XHP2408H 1920*1200 portrait

User avatar
shijan
Mitglied
Posts: 360
Joined: Mon 23 Dec 2019 15:21

Re: Dithering from 16 bit to 8 bit

Post by shijan » Tue 01 Sep 2020 23:39

Formally It is a bug. But usually it is not recommended to convert from 32 bit linear directly to 8 bit gamma corrected. And i have no technical background to explain why.

Here is how convert 100% without artifacts:
Step 1.
- Open Tool -> Color -> Convert with Color Profile
- do not change color space (select original sRGB or other color space that you used)
- Uncheck "Linear Brigthness (Gamma 1.0)" (this will convert linear gamma to normal sRGB gamma)

Step 2.
Do Bit depth convert from 32 to 8 bit.
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302

User avatar
shijan
Mitglied
Posts: 360
Joined: Mon 23 Dec 2019 15:21

Re: Dithering from 16 bit to 8 bit

Post by shijan » Wed 02 Sep 2020 00:04

Another suggest - just render directly to gamma corrected image to 16 bit Tiff file and use tone mapping in render settings. But not all renders have proper tone mapping option.

Render to EXR in linear gamma without tone mapping require some proper color space transform and tone mapping post processing workflow to make image look pretty. EXR use sRGB color space as default, but because it is 32 bit float with linear gamma it formally compress infinity amount of all possible source color data from render to sRGB coordinates, and you can unpack that wide gamut color data back to any desired color space.
You can do it in DaVinci Resolve/Nuke or any other similar app that operates in 32 bit float and provides adjustable tone mapping and color space compression tools.

Check part of this workflow tutorial here. It explains how to adjust phisically based Exposure in non RAW files.
https://forum.blackmagicdesign.com/view ... 25#p537852
Image
Image
Image
Image
PhotoLine UI Icons Customization Project: https://www.pl32.com/forum3/viewtopic.php?f=3&t=6302