Display RGB channels shows alpha premultiplied color with 8-bit images #83342

Open
opened 2020-12-03 00:44:40 +01:00 by Jose Conseco · 9 comments

System Information
Operating system: Linux-5.8.18-1-MANJARO-x86_64-with-arch-Manjaro-Linux 64 Bits
Graphics card: GeForce GTX 1660 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100

Blender Version
Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: 0f45cab862
Worked: blender-2.90.1

Short description of error
Display RGB channels shows alpha premultiplied color with 8-bit images. See sampled color in image editor. It should be all white
untitled.png

Sorry for using sequencer to demonstrate this, it was quickest method to render data I need.

Exact steps for others to reproduce the error
#83342.blend

  • Open file
  • Render

Sample color in black area in image editor

RGB channels have value of 1, pixels are black however.

**System Information** Operating system: Linux-5.8.18-1-MANJARO-x86_64-with-arch-Manjaro-Linux 64 Bits Graphics card: GeForce GTX 1660 SUPER/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 440.100 **Blender Version** Broken: version: 2.91.0, branch: master, commit date: 2020-11-25 08:34, hash: `0f45cab862` Worked: blender-2.90.1 **Short description of error** Display RGB channels shows alpha premultiplied color with 8-bit images. See sampled color in image editor. It should be all white ![untitled.png](https://archive.blender.org/developer/F9524611/untitled.png) Sorry for using sequencer to demonstrate this, it was quickest method to render data I need. **Exact steps for others to reproduce the error** [#83342.blend](https://archive.blender.org/developer/F9524630/T83342.blend) - Open file - Render # Sample color in black area in image editor RGB channels have value of 1, pixels are black however.
Author

Added subscriber: @JoseConseco

Added subscriber: @JoseConseco
Member

Added subscriber: @EAW

Added subscriber: @EAW
Member

Changed status from 'Needs Triage' to: 'Needs User Info'

Changed status from 'Needs Triage' to: 'Needs User Info'
Member

Code in question for other Triagers:

import numpy as np

if "TestImg.png" not in bpy.data.images.keys():

bpy.data.images.new("TestImg.png", width=128, height=128, alpha=True, float_buffer=False)

outputImg = bpy.data.images["TestImg.png"] 
outputImg.alpha_mode = 'STRAIGHT'
outputImg.file_format = 'TARGA' #does nothing
np_out_img = np.ones((128,128,4), dtype = np.float16)

# disable line below  to see it affects not only A channel. It should not affect RBG channels
np_out_img[:,:30,-1]=0 # set left half  Alpha channel) to black - 
outputImg.pixels = np_out_img.ravel()  #flatten the array to 1 dimension and write it to testImg pixels```

With the caveat that I don't know much about python as other Triagers, the results for me are the same using 2.83.8, 2.90.1, 2.91.0, and 2.92 cc6ec71b1934.

Opening the file, there is an image with RGBA values of (0, 0, 0, 1)
![TestImg_before running.png](https://archive.blender.org/developer/F9475523/TestImg_before_running.png)

Running the script produces an image with RGBA values of (1, 1, 1, 0) in the left 30 pixels of the image, and (1, 1, 1, 1) in the rest.

2.90
![2.90_double_check_TestImg.png](https://archive.blender.org/developer/F9475531/2.90_double_check_TestImg.png)

2.91
![2.91_double_check_TestImg.png](https://archive.blender.org/developer/F9475533/2.91_double_check_TestImg.png)

Checking and seeing that the RGB values are all 1 for the entire image, and only the Alpha has changed.
![Gimp_RGB_are_still_1.0.png](https://archive.blender.org/developer/F9475535/Gimp_RGB_are_still_1.0.png)

Commenting out line 12 produces an image where all values are 1.
![TestImg_line12_commented_outpng.png](https://archive.blender.org/developer/F9475545/TestImg_line12_commented_outpng.png)

What difference do you see on your system?

What version of python and numpy are you running?

Code in question for other Triagers: ```import bpy import numpy as np if "TestImg.png" not in bpy.data.images.keys(): ``` bpy.data.images.new("TestImg.png", width=128, height=128, alpha=True, float_buffer=False) ``` outputImg = bpy.data.images["TestImg.png"] outputImg.alpha_mode = 'STRAIGHT' outputImg.file_format = 'TARGA' #does nothing np_out_img = np.ones((128,128,4), dtype = np.float16) # disable line below to see it affects not only A channel. It should not affect RBG channels np_out_img[:,:30,-1]=0 # set left half Alpha channel) to black - outputImg.pixels = np_out_img.ravel() #flatten the array to 1 dimension and write it to testImg pixels``` With the caveat that I don't know much about python as other Triagers, the results for me are the same using 2.83.8, 2.90.1, 2.91.0, and 2.92 cc6ec71b1934. Opening the file, there is an image with RGBA values of (0, 0, 0, 1) ![TestImg_before running.png](https://archive.blender.org/developer/F9475523/TestImg_before_running.png) Running the script produces an image with RGBA values of (1, 1, 1, 0) in the left 30 pixels of the image, and (1, 1, 1, 1) in the rest. 2.90 ![2.90_double_check_TestImg.png](https://archive.blender.org/developer/F9475531/2.90_double_check_TestImg.png) 2.91 ![2.91_double_check_TestImg.png](https://archive.blender.org/developer/F9475533/2.91_double_check_TestImg.png) Checking and seeing that the RGB values are all 1 for the entire image, and only the Alpha has changed. ![Gimp_RGB_are_still_1.0.png](https://archive.blender.org/developer/F9475535/Gimp_RGB_are_still_1.0.png) Commenting out line 12 produces an image where all values are 1. ![TestImg_line12_commented_outpng.png](https://archive.blender.org/developer/F9475545/TestImg_line12_commented_outpng.png) What difference do you see on your system? What version of python and numpy are you running?
Author

I just did fresh install of official 2.91, this time on windows 10, with default settings and still RBG is multiplied by A
Python: 3.7.7
Numpy shows version: 1.17.5

image.png

Btw you can check RBG channels in the top-right corner of blender image editor.
And it works in blender 2.90 and below versions on both windows and linux . Looks like its not OS related.

I just did fresh install of official 2.91, this time on windows 10, with default settings and still RBG is multiplied by A Python: 3.7.7 Numpy shows version: 1.17.5 ![image.png](https://archive.blender.org/developer/F9476765/image.png) Btw you can check RBG channels in the top-right corner of blender image editor. And it works in blender 2.90 and below versions on both windows and linux . Looks like its not OS related.
Author

Changed status from 'Needs User Info' to: 'Needs Triage'

Changed status from 'Needs User Info' to: 'Needs Triage'
Author

Since I have additional info I change status of report back to Need Triage

Since I have additional info I change status of report back to Need Triage
Richard Antalik changed title from Alpha channel value affects RGB channels brightness when set form img.pixels to Display RGB channels shows alpha premultiplied color with 8-bit images 2020-12-22 07:07:32 +01:00

Changed status from 'Needs Triage' to: 'Confirmed'

Changed status from 'Needs Triage' to: 'Confirmed'
Member

It appears I have had a reply saved in Phabricator that I never sent. Sorry about that.


Thank you for clarifying. I now understand and can reproduce the display issue. It appears that Blender is multiplying the alpha and color channels together before displaying them, even when inspecting the color channels alone.

In the following picture, my mouse is in the black part of the image, and the display channels are set to color.
2.92_Image_editor_SS_color_annotated.png

It appears I have had a reply saved in Phabricator that I never sent. Sorry about that. --- Thank you for clarifying. I now understand and can reproduce the display issue. It appears that Blender is multiplying the alpha and color channels together before displaying them, even when inspecting the color channels alone. In the following picture, my mouse is in the `black` part of the image, and the display channels are set to `color`. ![2.92_Image_editor_SS_color_annotated.png](https://archive.blender.org/developer/F9500564/2.92_Image_editor_SS_color_annotated.png)
Philipp Oeser removed the
Interest
EEVEE & Viewport
label 2023-02-09 15:14:08 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#83342
No description provided.