woelper / oculante

A fast and simple image viewer / editor for many operating systems
https://github.com/woelper/oculante
MIT License
988 stars 44 forks source link

Images with an Alfa channel of 0 and unpremult, are invisible with the default RGBA view #178

Closed tonynoce closed 1 year ago

tonynoce commented 1 year ago

The default view for images seems to be RGBA which is fine for most use cases but in VFX an alpha channel can be ignored since the composition doens't have to rely on an Alpha to be there. Yet it is exported as black or in some cases with information.

Currently the fix is to change to RGB by hand, but if the channel Alpha is equal to 0, there is no GUI feedback and the user only sees a grey window.

I saw the unpremult example in the test and made this one, with the corresponding use case escenario: ( the pic is down here ) unpremult_alpha_0

woelper commented 1 year ago

Thank you for opening the issue! I do think what you are seeing is exactly what should happen though. Imagemagick's identify says about your image above:

identify -verbose 232267475-846fe66f-a015-4910-b330-3d2a87de2255.png
Image:
  Filename: 232267475-846fe66f-a015-4910-b330-3d2a87de2255.png
  Format: PNG (Portable Network Graphics)
  Mime type: image/png
  Class: DirectClass
  Geometry: 1920x1080+0+0
  Units: Undefined
  Colorspace: sRGB
  Type: TrueColorAlpha
  Base type: Undefined
  Endianness: Undefined
  Depth: 8-bit
  Channel depth:
    red: 8-bit
    green: 8-bit
    blue: 8-bit
    alpha: 1-bit

So it is a TrueColorAlpha image with an Alpha Channel which says none of the pixels should be visible. Oculante does the correct thing: It shows the image as fully transparent (as my browser does in your example image, and all other desktop viewers I tried on my linux machine). The difference is that Oculante can show the "hidden" image data. Is it a good user experience currently in Oculante? I don't think so. Right now you just get a grey screen, so you don't even know if your image loaded. The new release will have a "checkerbox background" pattern soon, maybe that could help? Also maybe drawing a small frame around the image could help? I could also store the mode in the user preferences, so you set Oculante to RGB once and it will remember it.

I am a bit clueless how to improve your experience other than the things above - if I make RGB the default display, many users will wonder why the alpha channel does not display. I could switch the mode if the image is completely transparent, but for that I'd need to go every pixel in the image, which costs a lot of performance.

Happy for your feedback!

woelper commented 1 year ago

This is how it could look with a frame: image

woelper commented 1 year ago

And with a checker pattern: image

tonynoce commented 1 year ago

Well the checkboard pattern is the general consensus of an alpha being zero or transparency :D And the grey lines are also a nice touch !

I did realize that I approached this with a compositing program instead of with an image viewer one, below I made some contact sheets with RGBA channels to further illustrate the issue... But I guess that this is more of a general issue with premult and unpremult as you say before, since this is something that most user don't have to deal with it.

All images below are unpremult :

unpremul_test_alpha_full

unpremul_test_alpha_zero

unpremul_test_alpha

woelper commented 1 year ago

I have also added the feature to remember your last channel settings between restarts. You can then set the mode to "Rgb" and oculante will remember this. I hope this will make it easier for you. Thanks for the example images!

woelper commented 1 year ago

Closing this as I have released a version with fixes as outlined above