exporting imagedata

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
User avatar
The Burrito
Party member
Posts: 153
Joined: Mon Sep 21, 2009 12:14 am
Contact:

exporting imagedata

Post by The Burrito »

So I'm trying to grab imagedata out of love and get it into a use able format. I can get it to save the data as a file:

Code: Select all

screenshot = love.graphics.newScreenshot( )
		love.filesystem.write( "screenshot", screenshot:getString( ))
but from there I'm not really sure how to import it into an image editor because I don't know the details of love's imagedata. I would assume its 8 bit 4 channel but is there any kind of file header or anything? everything I try spits out garbage, but its clearly the screenshot I took.


EDIT: OK, I can get a clean image out of it now (4 channel 8 bit Interleaved) but the coloration and contrast are off, I have no idea why that would happen though.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: exporting imagedata

Post by thelinx »

Use love.image.newEncodedImageData and love.filesystem.write.

Basically:

Code: Select all

screenshot = love.image.newEncodedImageData(love.graphics.newScreenshot(), "bmp")
love.filesystem.write("screenshot.bmp", screenshot)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Semrush [Bot] and 82 guests