Hi,
I'm trying to simply save a screenshot in a bmp image. I'm listening to a mouse click to take the screenshot and I'm executing:
local s = love.graphics.newScreenshot() --ImageData
local d = love.image.newEncodedImageData(s, "bmp")
local success = love.filesystem.write("pic.bmp", d)
but I get the following error:
'Data could not be written'
I also tried to set the identity to a 'sheet' folder but it's not working. I've also tried to use the :encode("bmp") function instead of newEncodedImageData but it's not working. Any idea what I do wrong?
note: I'm dragging and dropping my folder on a shortcut of love.exe, but that should not be a problem right?
thanks for the help!
save a screenshot is not working, why?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: save a screenshot is not working, why?
The code you pasted should work. It's possible that the configuration of your system prevents LÖVE to write in the %APPDATA% path, but that's just a guess.
Can you show us how you set the identity?
Can you show us how you set the identity?
Shallow indentations.
Re: save a screenshot is not working, why?
Thanks for the answer! 
I have this conf.lua file that sets the identity:
function love.conf(t)
t.screen.width = 1000
t.screen.height = 680
t.identity = "sheets"
t.console = true
end
my goal is to have the images saved inside the sheets folder. Can I redirect the image to a folder outside the APPDATA one? How can I check the privileges of LÖVE on the APPDATA folder?
thanks

I have this conf.lua file that sets the identity:
function love.conf(t)
t.screen.width = 1000
t.screen.height = 680
t.identity = "sheets"
t.console = true
end
my goal is to have the images saved inside the sheets folder. Can I redirect the image to a folder outside the APPDATA one? How can I check the privileges of LÖVE on the APPDATA folder?
thanks
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: save a screenshot is not working, why?
Please give us a .love, as the rules describe. Read how to make a .love file here. This way we can help you better and more quickly.
Help us help you: attach a .love.
Re: save a screenshot is not working, why?
I found out that by using the admin user on my PC the code actually works. Strange that the LOVE program doesn't have the access to write in the APPDATA folder when I use my other user.
Sorry I couldn't post a .love file but I'd have some images that I use in the code that I can't publish.
Problem solved then. I'd like to save it in a .png though...when is LOVE 0.8 coming out?
thanks for the help!
Sorry I couldn't post a .love file but I'd have some images that I use in the code that I can't publish.
Problem solved then. I'd like to save it in a .png though...when is LOVE 0.8 coming out?
thanks for the help!

Who is online
Users browsing this forum: No registered users and 5 guests