python api - python hsv values inconsistent with color picker values #50110

Closed
opened 2016-11-24 17:49:10 +01:00 by Nikolai Janakiev · 7 comments

Blender Version
Blender 2.78a and Blender 2.77a

Short description of error
converted HSV values in python API are inconsistent with the displayed color picker values

Exact steps for others to reproduce the error
In python console:

import bpy, colorsys
bpy.context.scene.world.horizon_color = colorsys.hsv_to_rgb(0.5, 0.5, 0.5)

or:

from mathutils import Color
import bpy
c = Color()
c.hsv = (0.5, 0.5, 0.5)
bpy.context.scene.world.horizon_color = c

Both code snippets displays the HSV values: (0.5, 0.27, 0.735) in the color picker.

**Blender Version** Blender 2.78a and Blender 2.77a **Short description of error** converted HSV values in python API are inconsistent with the displayed color picker values **Exact steps for others to reproduce the error** In python console: import bpy, colorsys bpy.context.scene.world.horizon_color = colorsys.hsv_to_rgb(0.5, 0.5, 0.5) or: from mathutils import Color import bpy c = Color() c.hsv = (0.5, 0.5, 0.5) bpy.context.scene.world.horizon_color = c Both code snippets displays the HSV values: (0.5, 0.27, 0.735) in the color picker.

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @paramcookie

Added subscriber: @paramcookie
Bastien Montagne was assigned by Aaron Carlisle 2016-11-26 16:55:37 +01:00

Added subscriber: @brecht

Added subscriber: @brecht

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'

There are multiple ways to do HSV to RGB conversion, and it also depends on the color space (sRGB, linear, ..).

colorsys is a module part of Python itself which uses a different formula than Blender, we don't consider that to be a bug.

There are multiple ways to do HSV to RGB conversion, and it also depends on the color space (sRGB, linear, ..). `colorsys` is a module part of Python itself which uses a different formula than Blender, we don't consider that to be a bug.

Thank you for the reply!

When printing out the value of bpy.context.scene.world.horizon_color.hsv, the output value is also inconsistent for the hsv values for the horizon color in the color picker.
Is the mathutils.Color class also inconsistent with the color conversion in Blender?

Thank you for the reply! When printing out the value of `bpy.context.scene.world.horizon_color.hsv`, the output value is also inconsistent for the hsv values for the horizon color in the color picker. Is the `mathutils.Color` class also inconsistent with the color conversion in Blender?

The HSV value edited in the color picker is in display space (sRGB by default). The values in the API are in scene linear space.

The HSV value edited in the color picker is in display space (sRGB by default). The values in the API are in scene linear space.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 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-addons#50110
No description provided.