[Solved] Nothing happen with imageData:encode()
Posted: Tue Apr 26, 2022 6:16 pm
Here is a simple example about how to output picture to a png file (in 0.11+), after what I read, the exemple on the wiki is not clear, and didn't found anything, but some that tried before 0.11.
I use LÖVE 0.11.4, nothing happen, no file created, no error, rights to write.
I use LÖVE 0.11.4, nothing happen, no file created, no error, rights to write.
Code: Select all
function love.load()
canvas = love.graphics.newCanvas(800,600)
love.graphics.setCanvas(canvas)
love.graphics.circle("fill",200,200,100)
-- need to set another Canvas to avoid Canvas:newImageData cannot be called while that Canvas is currently active.
love.graphics.setCanvas()
imagedata = canvas:newImageData()
imagedata:encode("png","test.png")
end
function love.draw()
end