Saving Images?

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
zipperipper
Prole
Posts: 45
Joined: Thu Jan 14, 2010 7:59 pm
Location: UK

Saving Images?

Post by zipperipper »

Hello, i was wondering if there is a way to save images via love.image or love.filesystem?
Ive attempted it but haven't found a successful way.
Is there a way in 0.6.2? if not could there be in one of the next updates(like love.image.save(image/imagedata))?
Error 404, consciousness not found.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Saving Images?

Post by bartbes »

If you have image data you can encode it using love.image.newEncodedImageData, which you can then use to write to a file.
User avatar
zipperipper
Prole
Posts: 45
Joined: Thu Jan 14, 2010 7:59 pm
Location: UK

Re: Saving Images?

Post by zipperipper »

bartbes wrote:If you have image data you can encode it using love.image.newEncodedImageData, which you can then use to write to a file.
right, and how do i get the string to write to the file?
Error 404, consciousness not found.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Saving Images?

Post by bartbes »

Using the love.filesystem functions.
User avatar
vrld
Party member
Posts: 917
Joined: Sun Apr 04, 2010 9:14 pm
Location: Germany
Contact:

Re: Saving Images?

Post by vrld »

or this:

Code: Select all

pixels = ImageData:getString( )
I have come here to chew bubblegum and kick ass... and I'm all out of bubblegum.

hump | HC | SUIT | moonshine
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Saving Images?

Post by bartbes »

That would be raw.. don't think you want that.
User avatar
zipperipper
Prole
Posts: 45
Joined: Thu Jan 14, 2010 7:59 pm
Location: UK

Re: Saving Images?

Post by zipperipper »

an example maybe please?
Error 404, consciousness not found.
User avatar
bmelts
Party member
Posts: 380
Joined: Fri Jan 30, 2009 3:16 am
Location: Wiscönsin
Contact:

Re: Saving Images?

Post by bmelts »

Code: Select all

hi = love.image.newImageData("hi.png")
hello = love.image.newEncodedImageData(hi, "tga")
love.filesystem.write("hello.tga", hello)
Will convert hi.png to TGA and write it to hello.tga.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 148 guests