13thsymphony / HDRImageViewer

UWP app to view high dynamic range (HDR) and wide color gamut (WCG) images.
https://13thsymphony.github.io/
MIT License
76 stars 21 forks source link

Fix large images still not being openable #59

Open Filoppi opened 1 year ago

Filoppi commented 1 year ago

5120x1440 jxr HDR images fail to be opened when the app is in a maxed out window, because the histogram still fails to draw (EndDraw() has an exception within itself, and returns error D1225). I haven't really spent much time analyzing how the histogram is used, but I have found that the jxr image is visualized exactly the same way whether the EndDraw() failed or not (thus the max luminance (CLL) remains n/a). I can manage to open these images, but only if the app started in a small window. If it's maxed out, it will throw the error.

I'm on the latest version of Win 11 and have a recent high end Nvidia card (I don't think it matters). My resolution is set to 5120x1440 and DPI to 100% (so 96).

I have found that changing the SetDpi() call from 96 to 1 avoids the exception to be throw, though it actually kind of breaks the final image rendering and the max luminance value. I know that makes no sense, I was just messing around.

Before the code was changed to add the SetDpi() workaround (from @imbushuo), it errored out even more often, though I'm not sure exactly what improved.

This is unrelated to this PR, but I also noticed the max luminance calculated by the app depends on the window size. You can test it by making the window tiny and opening the same image multiple times. I suppose the histogram is rendered in a way that depends on the window size, while it shouldn't?

Filoppi commented 1 year ago

This fork has some of the some fixes for the stuff I mentioned above: https://github.com/EndlesslyFlowering/HDRImageViewer

Filoppi commented 1 year ago

@13thsymphony hey, sorry to bother, just wondering if there was any intention of merging this?