Gets the color of a pixel at a specific position in the image.
Valid x and y values start at 0 and go up to image width and height minus 1.
r, g, b, a = ImageData:getPixel( x, y )
number r
number g
number b
number a
Iterates over the pixels of an image and stores them in a sequence.
local image = love.image.newImageData( 'path/to/Image.png' ) local pixels = {} for x = 1, image:getWidth() do for y = 1, image:getHeight() do -- Pixel coordinates range from 0 to image width - 1 / height - 1. local pixel = image:getPixel( x - 1, y - 1 ) pixels[#pixels + 1] = pixel end end return pixels
© 2006–2016 LÖVE Development Team
Licensed under the GNU Free Documentation License, Version 1.3.
https://love2d.org/wiki/ImageData:getPixel