https://bugs.kde.org/show_bug.cgi?id=400353

            Bug ID: 400353
           Summary: All channels pixelData is Blue channel
           Product: krita
           Version: 4.1.5
          Platform: MS Windows
                OS: MS Windows
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: Scripting
          Assignee: krita-bugs-n...@kde.org
          Reporter: chockablock...@outlook.com
  Target Milestone: ---

Can only read and write to Blue channel from Node::channels() list, no matter
which channel is accessed (Channel::name() works correctly however).


STEPS TO REPRODUCE
1. Create new document (something small, say 2x2 pixels)
2. Fill with yellow (255, 255, 0)
3. Run the following script:

from krita import *
from PyQt5.QtCore import QByteArray, QRect

doc = Krita.instance().activeDocument()
layers = doc.rootNode().childNodes()
channels = layers[0].channels()

greenChan = channels[1]
print(greenChan.name()) # Prints 'Green'
rect = greenChan.bounds()

# Print out 1
for chan in channels:
    print("Channel: " + chan.name())
    px = chan.pixelData(rect)
    print(px)

val = int(128)
pxData = greenChan.pixelData(rect)

pxData.fill(val.to_bytes(1, byteorder='little'))
greenChan.setPixelData(pxData, rect)

# Print out 2
for chan in channels:
    print("Channel: " + chan.name())
    px = chan.pixelData(rect)
    print(px)
doc.refreshProjection()

OBSERVED RESULT
Print out 1 in above script prints all \x00s for all channels
Print out 2 in above script prints all \x80s for all channels
Image is pale yellow (255, 255, 128)

EXPECTED RESULT
Print out 1 should print \x00 for Blue channel and \xFF for other channels
Print out 2 should print \x00 for Blue, \x80 for Green and \xFF for Red/Alpha
Image should be orange (255, 128, 0)

SOFTWARE VERSIONS
(available in About System)
Krita
  Version: 4.1.5

Qt
  Version (compiled): 5.9.3
  Version (loaded): 5.9.3

OS Information
  Build ABI: x86_64-little_endian-llp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: winnt
  Kernel Version: 6.1.7601
  Pretty Productname: Windows 7 SP 1 (6.1)
  Product Type: windows
  Product Version: 7sp1

OpenGL Info
  **OpenGL not initialized**

ADDITIONAL INFORMATION
Same behaviour occurs in Krita 4.1.3.
Same behaviour occurs no matter which channel is accessed

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to