Problem with display.save and display.captureScreen

I’ve seen a couple of related forum posts, but they haven’t straightened me out…

I’ve been trying to get display.save to work in my app, but all that I get is a black rectangle. display.captureScreen gives me the same results.

I tried running the sample project, CaptureToFile, same thing—I just get an image of a black rectangle saved in entireScreen.jpg.

Matt
[import]uid: 78 topic_id: 405 reply_id: 300405[/import]

Matt

can you send me code? at info@anscamobile.com

thanks

carlos [import]uid: 24 topic_id: 405 reply_id: 730[/import]

Ok, I’ve just sent it. I could probably strip out more code and still send you something that reproduces the problem, but what I’ve sent is pretty short and I’m not doing anything tricky. Let me know, however, if you want a smaller example.

When I run it, it puts an image file (“Picture 1.png”, or “Picture 2.png”, etc.) on the desktop. If I open it, all I see is a black rectangle. Essentially the same result if I try display.save rather than display.captureScreen.

One question—what should the result be when I run the CaptureToFile sample code? The “thumbnail” that it shows is just a black rectangle, as is the image that gets saved in “entireScreen.jpg”.

BTW this is with version 1.01 of Corona (2010.1.8.1).

Thanks,

Matt
[import]uid: 78 topic_id: 405 reply_id: 731[/import]

I added

local baseDir = system.DocumentsDirectory
display.save( display.currentStage, “entireScreen.jpg”, baseDir )

and removed

–display.captureScreen(false)
and it works

also if i set display.captureScreen(true) it works on the simulator (saves the image to the desktop)

i did not try it on the device.

C.
[import]uid: 24 topic_id: 405 reply_id: 732[/import]

Sorry for the delay…I’ve been swamped with other things.

I tried the changes you suggested above and it still does not work. All I get is a totally black image.

Matt
[import]uid: 78 topic_id: 405 reply_id: 841[/import]

I tried something as dirt-simple as I could. Code attached below. And the result is a corrupted image file.

local b = display.newRect(100, 100, 40, 50)
b:setFillColor(255, 255, 0)
local baseDir = system.DocumentsDirectory
display.save( display.currentStage, “entireScreen.jpg”, baseDir )

Here’s a link to the item: resulting image.

I tried a slight change to:

local b = display.newRect(100, 100, 40, 50)
b:setFillColor(255, 255, 0)
local baseDir = system.DocumentsDirectory
display.save( b, “b.jpg”, baseDir )

And here’s what I get: second result.
[import]uid: 78 topic_id: 405 reply_id: 844[/import]

I just copied and pasted your two pieces of code into and ran Corona and it worked for me.

Also, can you tell me what Mac you are on? Intel or PPC?

c
[import]uid: 24 topic_id: 405 reply_id: 852[/import]

It’s a MacBook Pro with an Intel chip. I’m currently running OS X 10.6.2 (although I was running 10.5.x when I posted the first message).

Thanks,

Matt
[import]uid: 78 topic_id: 405 reply_id: 853[/import]

Just tried the CaptureToFile sample with the new 1.1 SDK.

Here are the results—I ran the program three times and got three different corrupted images: scr0.jpg, scr1.jpg and scr2.jpg. [import]uid: 78 topic_id: 405 reply_id: 868[/import]

Ok, I have a few spare minutes so I want to try and resolve this issue.

First things first, could somebody describe, or preferable post an image somewhere, what results I should be seeing from the CaptureToFile sample project? I am confident it’s _not_ supposed to be the garbled image I posted above.

Thanks,

Matt
[import]uid: 78 topic_id: 405 reply_id: 1138[/import]

I am trying to get display.save to work on iPad and it is crashing on the device and in the simulator.
display.setStatusBar( display.HiddenStatusBar )

local group = display.newGroup()

local newimg = display.newImage( “px9W.png” )
group:insert( newimg, true )

local function onTouch( event )

local baseDir = system.DocumentsDirectory
display.save( display.currentStage, “entireScreen.jpg”, baseDir )

end

local saveBtn = display.newRect(400,400,20,20)
saveBtn:setFillColor(255,255,255,255)

saveBtn:addEventListener( “touch”, onTouch )
[import]uid: 4254 topic_id: 405 reply_id: 2734[/import]

Are you guys using Corona SDK 2.0 or Corona SDK 1.1?

I believe we fixed this but in Corona 2.0 SDK

Carlos [import]uid: 24 topic_id: 405 reply_id: 2762[/import]

Hi Carlos - thanks for the quick reply - I’m using corona 2.0 beta 4 - I was able to get the screen capture code to work but when I tried using the code to capture just a group it crashed on both my iPad and in the simulator - [import]uid: 4254 topic_id: 405 reply_id: 2765[/import]