SandCastleIcon.png This article has links to websites or programs outside of Scratch and Wikipedia. Remember to stay safe while using the internet, as we cannot guarantee the safety of other websites.
This article or section documents the current version of Scratch (version 3.0). For this article in Scratch 2.0, see Project Compression (2.0). For this article in Scratch 1.4, see Project Compression (1.4).

In Scratch 3.0, the total size of a project is unlimited.[1] However, projects with large file sizes will take a very long time to load, and there are other restrictions:

  • Each asset (costume and sound) has a limit of 10 MB[2]
  • The project.json file, which contains the project's code, has a limit of 5 MB.[3]

If a project reaches one of these two limits, there are several ways to reduce the size.

Sprites and Scripts

A project may contain unneeded sprites and scripts, and deleting them will decrease the size of a project.

Duplicate sprites can be deleted, as stamping or cloning can be used instead.

There may be large scripts that are repeated multiple times, which may take up lots of data. This can be removed by creating a custom block or using broadcasts.

Blocks may have text hidden behind a reporter or variable block. If a block contains a large text covered by a reporter block, the project's size can be reduced by removing it, which can be achieved by dragging the reporter out, deleting the text, and dragging it back in.

Comments store unnecessary information in runtime. To reduce the project's size, comments may be deleted.

Lists and variables may contain data that is deleted or reset upon clicking the green flag. Before saving the project, clear the specific lists and variables that are reset to reduce the size.

Advanced Methods

Note Warning: These methods are advanced and require knowledge about how to access and edit the project.json file. They may break your projects.

Numbers entered into string parameters may be represented as strings in the project.json file. A small number of unnecessary parentheses could be removed by removing the quotations from the numbers. Additionally, large numbers may be stored as hexadecimal or in scientific notation to further shorten the file. Some blocks interpret Number types and String types differently, such as the costume block. Changing strings to numbers may accidentally break the project if values in the types of blocks mentioned are changed.

Block IDs are typically represented as long strings in the project.json file. Shortening the IDs to use 1, 2, or 3 characters will shorten the file by a few kilobytes. Variable IDs are stored in a similar manner, so shortening the IDs may also work.

Input menu dropdown blocks aren't needed, as the main parent block can simply store the value the menu is holding. This has the effect of making blocks such as switch costume to (dropdown v) appear as switch costume to [not a dropdown]


Backdrops and Costumes

There could also be backdrops or costumes that are not being used. Deleting unused backdrops and costumes will free up space.

Bitmap images can be compressed. If they are from a local computer, they can be compressed externally using a tool like TinyPNG and uploaded.

If a bitmap costume can be shown as a vector image, consider using a vector costume as vector images tend to take up less space.[citation needed]

If this is not possible, the image can be scaled down and back up, but that may cause unwanted pixelation.

Vector images can be further reduced in size by removing (and possibly replacing) excessive details such as windows on a building or fur on a hairy monster. Vector may also be compressed externally using a tool such as Nano.

Sounds

Unused sound files can be deleted because they take up a lot of space. Deleting them can reduce the project's size.

If a project contains sounds are from one's hard drive, then they can be replaced with a compressed version. One way to compress sounds is to convert them to an MP3 file using a third-party site.

See Also

References

  1. Flowermanvista. (8/8/2019). "It's worth noting that these are the only size limits - there is no limit on overall project size." topic:366461
  2. Flowermanvista. (8/8/2019). "No asset can exceed 10 MB." topic:366461
  3. Flowermanvista. (8/8/2019). "The project.json file cannot exceed 5 MB." topic:366461