Note Note: Although this guide is mostly antiquated by the Block Plugin, it can still be useful for special purposes on this wiki, including examples of images of scripts

There are several ways to create images of blocks or scripts. Here is a tutorial of the preferred way for creating images for the Scratch Wiki. This tutorial uses several programs that are available for free. They are available in the programs section of this tutorial. When done correctly, this method should only take about 5 minutes.

Take a Screenshot

A typical screenshot before it is cropped.

Once the script is ready, take a screenshot of the script. On Windows, press the key combination Ctrl+Print Screen. This copies the pixels of the entire screen to the clipboard. It can then be pasted into GIMP. Once it is in GIMP, it can be cropped. On a Macintosh, use the Grab software that comes with Mac OS X. Grab is located in /Applications/Utilities. You can also use the Preview application in /Applications to take a screenshot. To use Preview, choose File>Take Screen Shot. Be sure to save it in the PNG format. After it is saved, quit Grab/Preview and open the image in GIMP. This can be done by control+clicking the image and choosing Open With>GIMP.

Transparency

Once the image is open in GIMP, cut and paste the image back onto the canvas.

Note Note: This step is essential, because otherwise the image cannot become transparent.

Zoom in and remove all grey lines using the Fuzzy Select tool. Be careful not to forget the grey in the cracks between the blocks.

Removing the grey background.

Indexing and Optimization

Once the image has a transparent background, it is time to index the image. Indexing the image converts the image to 256 colors or fewer, and removes the data for the unused colors from the image file, which reduces the filesize. Indexing works well for block images, because they contain fewer than 256 colors.

The index option on the menu.
Note Warning: If there is any visual change to the image, undo the indexing.

After it's indexed, save the file as a PNG with level 9 compression. Close GIMP and right-click (or ctrl-click on a Mac) the image and select Open With.

Where to find optiPNG.

Choose optiPNG, let it run, and then do the same thing with PNGOUT.

PNGOUT running.
The finished product.
These programs optimize the PNG, which cleans up the image internally without making any changes to how it looks, which reduces filesize. Once it has been run through these programs, it is ready to be uploaded. Remember to categorize the image!

Programs

  • GIMP, a free graphics editing program (Windows/Mac OS X/Linux)
  • optiPNG, a PNG optimizer (Windows/Mac OS X/Linux)
  • PNGOUT, another PNG optimizer (Windows/Mac OS X/Linux)