Hello there o/
I want to go through all frames and read the pixel contents of all merged layers.
For this I made the following code:
got object with all frames
local frames = app.sprite.frames
thru the circle get next frame:
local frames = app.sprite.frames
for fNum = 1, #frames, 1 do
local frame = app.sprite.frames[fNum]
Next I get the image through the frame sprite
local image = Image(frame.sprite)
for it in image: pixels() do
local pixelValue = it()
local pc = app.pixelColor
local r = pc.rgbaR(pixelValue)
local g = pc.rgbaG(pixelValue)
local b = pc.rgbaB(pixelValue)
The RGB data got fine, but there is a problem.
This data is always only from the first frame, that is, it is always the same.
And I can’t figure out whether I’m not getting the Image() object correctly or whether there’s something wrong here.
If you output debug data to the console, you can see that the pointers to the sprite object are different, but the RGB data is the same:
print(frame.frameNumber, frame.duration, frame.sprite)
Thank you very much in advance