Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Way to get each pixel RGBA values? #2

Open
w7rus opened this issue Mar 3, 2020 · 0 comments
Open

Way to get each pixel RGBA values? #2

w7rus opened this issue Mar 3, 2020 · 0 comments

Comments

@w7rus
Copy link

w7rus commented Mar 3, 2020

Kinda confused what does .data contain in loaded object and how to use pixels() method.

I've ended up doing something like this because data was length of 4 * width * height, but that gave no positive result...

local data = testpnmg.load(pngContents)

local charArray = ffi.new("unsigned char[" .. #data.data .."]")
ffi.copy(charArray, data.data, #data.data)
for i=1, #data.data / 4 do
    print("R ", charArray[i], " G ", charArray[i + 1], " B ", charArray[i + 2], " A ", charArray[i + 3])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant