Save Canvas as image to file - 0.8

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
larios
Prole
Posts: 7
Joined: Wed Apr 18, 2012 4:50 pm

Save Canvas as image to file - 0.8

Post by larios »

Hi,

i had this code pre 0.8

Code: Select all

			local canvasData = canvas:getImageData() 
			local canvasImage = love.image.newEncodedImageData(canvasData, "bmp")
			local success = love.filesystem.write("pic.bmp", canvasImage)
newEncodedImageData seems to be not available anymore(?), how can i repair it?
User avatar
Camewel
Prole
Posts: 20
Joined: Thu Apr 19, 2012 5:58 pm

Re: Save Canvas as image to file - 0.8

Post by Camewel »

If I'm not mistaken, you can replace the second two lines with:

Code: Select all

canvasData:encode("pic.bmp")
larios
Prole
Posts: 7
Joined: Wed Apr 18, 2012 4:50 pm

Re: Save Canvas as image to file - 0.8

Post by larios »

yes that's right thanks :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests