Save background as file

Hi there! I wonder whether there is a way to create a file from the background and save it to disk from within SNAP!, probably as a block.

Hi!

It's pretty easy from the GUI, just right click the stage sprite and click on "pic..." to export an image of the stage to the Downloads folder of your browser:

One of our interns also wrote a JavaScript function which lets you export stuff programatically. Here's his block definition and how you can use it:


image

@susscrofa: You said "background" in your original message. That's a technical term for us, probably isn't what you want, and certainly isn't what the previous replies are offering.
So...

  • Background: Like a costume for the stage, came from a file in the first place, and can be exported to a file from the stage's background list (where the costume list would be in a sprite).
  • Map layer: This is a new thing that you get when you use the map library; it's above the background (that is, it's closer to your eyes, covering the background from view) but below pen trails.
  • Pen trails: These are the things drawn when you move a sprite with its pen down. The pen trail layer is above the map layer, but below the sprites themselves.
  • Sprites: Each sprite is in its own layer, and you can reorder them with blocks in the Looks palette.

So, now then: There are two main stage-picture things you can do:

  • "Pic..." from the stage's right-click menu will download the stage as you see it, including sprites if any are visible. It's exactly what you'd get if you used the screenshot feature of your operating system.
  • "Pen trails" in the same menu, or the PEN TRAILS reporter in the Pen category, gives you just the lines drawn by sprites' pens. The menu option doesn't download anything, but rather turns the picture into a costume, which it puts in the costume list of the current sprite (the one whose scripts are visible in the middle part of the window). (Of course you can then, if you want, export the costume to download the picture.) The reporter, of course, reports the picture, and can be used as input to blocks that take costumes as input, mostly found in the Looks category.

Hope that helps...

Wow! Is there any other script like this? Thank you.

What do you mean by "like this"?

Of this kind.

Unhelpful. Other scripts using Javascript? Other scripts about graphics? Etc.

Other scripts using JS.

Oops! I saw the "export costume (pen trails)" and didn't notice the "export costume (my costume)" right above it. When run in the stage, that does indeed save the background to a file. Sorry, @jadga!