Categories
BLOG

pictures of scratch

Capturing Images of Scripts

This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.

This tutorial explains how to capture an image of a script and save an image file of Scratch blocks to a computer. As of Scratch 3.0, only the Scratch 1.4 editor can directly save images of scripts.

Contents

  • 1 The Methods
    • 1.1 Scratch Editor Method
    • 1.2 Image Editing Method
    • 1.3 Scratch Editing Method
      • 1.3.1 PNG or GIF
      • 1.3.2 PNG Only
      • 1.3.3 Type PNG or GIF
  • 2 Comparison

The Methods

Scratch Editor Method

Note: This no longer works with the current version of Scratch.

The easiest way to save an image file is to right-click in the Scripts Area and press the “save picture of scripts” button. This method is the easiest, however, it does not offer the best resolution possible, because it saves the images in a .gif file format. .gif files are indexed to a certain set of 256 colors, which causes the colors of the blocks in these images to change slightly. Even though .gif files have their shortcomings, this method can still be used to create clear block images.

Prior to Scratch 1.4, this feature did not work correctly, and added a gray area around the image.

Image Editing Method

This method is a more difficult and tedious method of taking images of scripts. First, a screenshot of the script would need to be taken. Second, the screenshot needs to be opened in an image editor. The background of the scripts must be removed. Once that is done, the image should be saved, preferably in the .png file format. This method, however, is more time consuming, but it may produce a clearer image.

Scratch Editing Method

In this method, the System Browser must be opened and edited. Navigate to Scratch-UI-Panes >> ScratchScriptEditorMorph >> menu/button ops .

PNG or GIF

Paste in the following code:

Accept. (Right-click and choose accept or press Alt + S .)

Go to the method scriptsMenu: . Replace it with the following code:

It only adds the line:
t2 add: ‘save picture of scripts (PNG)’ action: #saveScriptsToPNG.
This calls the saveScriptsToPNG method that was just made. Accept. Save image for end user.

When the Scripts Area is clicked, the following menu will come up:
The “save picture of scripts (PNG)” works exactly the same as a GIF but saves in a different file format.

PNG Only

If a GIF will never be wanted, the saveScriptsToImage method can be changed to the following:

The scriptsMenu: method need not be edited.

Type PNG or GIF

In this method, it opens the regular dialog, and saves as a PNG unless the filename is specified to end with ” .gif “.

Replace the saveScriptsToImage method with the following code:

If simply ” Filename ” or ” Filename.png ” is typed, it will save as a PNG, but if ” Filename.gif ” is typed, it will be a GIF file.

The scriptsMenu: method need not be edited.

Comparison

The GIF image is very slightly brighter colored than the PNG image, but the difference is barely noticeable.

Capturing Images of Scripts This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective. This

Scratch User Guide: Adding Images & Sprites to a Scratch Program

Scratch Tutorial Note

This user guide was written for Scratch version 1.4, which is available at the Scratch 1.4 download page. Additional tutorials are available on the download page. Information about the most recent version of Scratch is available at the MIT Scratch website.

One fun feature of Scratch is that you can easily add any images and text that you want to your program. Do you want to draw a new Scratch cartoon character directly on the computer? Or add real photos of you and your friends to a Scratch dance animation you’re making? Or maybe create a rainbow-colored set of instructions for your Scratch game? You can do all of these things and much more with just a few clicks of the mouse.

Just above the sprites display area are three icons; they are circled in red below in Figure 1. The icons allow you to create your own sprite, import an existing Scratch sprite or an existing picture from your computer into the Scratch environment as a sprite, or get a surprise, pre-made Scratch sprite. Table 1 shows exactly which icon needs to be clicked for each of these tasks.

A screenshot of the program Scratch shows three new sprite buttons under the viewer window on the right side of the program. New sprites can be drawn by the user, uploaded from a file or randomly generated by Scratch.

Figure 1. The sprite icons, shown here circled in red, are used to create new sprites, import either a pre-made Scratch sprite or an existing picture from your computer into the Scratch program, or get a surprise, pre-made Scratch sprite.

Task Icon to Click Comments
Draw your own sprites (pictures or text) using the Scratch editor. Clicking the paint new sprite icon opens up the Scratch drawing editor where you can draw anything you want. You can also make text sprites.
Choose a sprite from your computer’s hard drive to import into your Scratch project. Clicking on the choose a new sprite from file icon will allow you to pick any image on your computer’s hard drive (including the pre-made sprites that come packaged with Scratch) to import as a Scratch sprite.
Get a pre-made surprise sprite. Clicking on the get a surprise sprite icon will make one of the pre-made sprites that comes packaged with Scratch appear in your project. You can choose to keep it or delete it.

Table 1. The three ways of adding sprites to a Scratch program.

When adding new sprites to a Scratch project, it is always a good idea to give them descriptive names. This allows you to easily figure out which sprite you’re referring to in the scripts. See Figure 2, below, for directions on where to enter sprite names.

A cropped screenshot of the sprite settings window in the program Scratch shows a textbox to rename sprites. The sprite textbox to rename a sprite is above the scripts, costumes and sounds tabs when a sprite is selected.

Figure 2. Sprites can be renamed using the text box circled in red, above.

Existing sprites can be modified by clicking on the Costumes tab.

Directions explaining how to add images, sprites, text and photos to a Scratch program.