Problem writing a screenshot.

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
Posts: 16
Joined: Tue May 01, 2012 6:27 am
Location: Oh no, not Finland!

Problem writing a screenshot.

Post by 1u4 » Sat May 26, 2012 1:03 pm

Hi, I'm having trouble writing with the newScreenshot() function.

Code: Select all

function love.load()

function love.draw()
	took = true
	screenshot =
	if took then
		took = false
		imageData = screenshot:encode( "png" ) 
		love.filesystem.write( "ss.png", imageData, 500 )
Why does imageData = screenshot:encode( "png" ) return nil? What am I doing wrong here?

There is a story of a farmer whose horse ran away. That evening the neighbors gathered to commiserate with him since this was such bad luck.
He said, "May be." Continued...

User avatar
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands

Re: Problem writing a screenshot.

Post by bartbes » Sat May 26, 2012 1:41 pm

Read up on ImageData:encode again, you're using it incorrectly.

User avatar
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: Problem writing a screenshot.

Post by Inny » Sun May 27, 2012 5:20 am

This is what I use (as of 0.8.0)

Code: Select all

function saveScreenshot()
  local name = string.format("screenshot-%s.png","%Y%m%d-%H%M%S"))
  local shot =
  shot:encode(name, "png")

Post Reply

Who is online

Users browsing this forum: No registered users and 42 guests