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.
-
zac352
- Party member
- Posts: 496
- Joined: Sat Aug 28, 2010 8:13 pm
- Location: In your head.
-
Contact:
Post
by zac352 »
I used code similar to this:
Code: Select all
local sc=love.graphics.newScreenshot()
local f=love.filesystem.newFile("img.png")
f:open("w")
f:write(sc)
f:close()
But no matter which format I try (png, bmp, jpg, ...), it always comes out as corrupt...
Any help would be appreciated.
Hello, I am not dead.
-
Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
-
Contact:
Post
by Robin »
Perhaps sc:getString()? I'm not sure how to do it right, but newScreenshot returns an ImageData. See below.
Last edited by
Robin on Sun Sep 26, 2010 9:48 pm, edited 1 time in total.
-
CyaNox
- Prole
- Posts: 22
- Joined: Thu Feb 11, 2010 6:11 pm
Post
by CyaNox »
Try something along the lines of:
Code: Select all
s = love.graphics.newScreenshot()
d = love.image.newEncodedImageData( s, "bmp" )
success = love.filesystem.write( "screenshot.bmp", d)
-
bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
-
Contact:
Post
by bartbes »
ImageData is raw image data, so you probably want to encode it using EncodedImageData first, as said above.
-
zac352
- Party member
- Posts: 496
- Joined: Sat Aug 28, 2010 8:13 pm
- Location: In your head.
-
Contact:
Post
by zac352 »
You should add png.
Hello, I am not dead.
-
Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
-
Contact:
Post
by Robin »
-
zac352
- Party member
- Posts: 496
- Joined: Sat Aug 28, 2010 8:13 pm
- Location: In your head.
-
Contact:
Post
by zac352 »
It's a good thing you can make images - setting individual pixels in something like a chart = death by lag
Hello, I am not dead.
Users browsing this forum: Bing [Bot], Google [Bot] and 7 guests