Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » extracting sprites from spritesheets within scratch
- LaughabIe
-
100+ posts
extracting sprites from spritesheets within scratch
obviously i don't think you can do this in vanilla scratch so i will bring the question here
using custom extensions, can you extract bits and pieces from a spritesheet image in a costume? i am creating an animation viewer for a couple of spritesheets i have extracted from a different game. i would much prefer this over simply creating each costume frame manually as it is 1. much less time consuming, 2. animation modules and parameters can be changed individually, and 3. heavily compresses the project file.
using custom extensions, can you extract bits and pieces from a spritesheet image in a costume? i am creating an animation viewer for a couple of spritesheets i have extracted from a different game. i would much prefer this over simply creating each costume frame manually as it is 1. much less time consuming, 2. animation modules and parameters can be changed individually, and 3. heavily compresses the project file.
- awesome-llama
-
1000+ posts
extracting sprites from spritesheets within scratch
When you say custom extensions, do you mean TurboWarp extensions? There are a couple that are relevant. The Clipping & Blending extension allows you to display a cropped portion of a costume. Pen+ also makes this possible by rendering textured triangles (a triangle can use any portion of a costume). I don't think there are any image processing extensions though.
—
It can be done in vanilla Scratch if you can get the image data into it. Images are usually binary formats and Scratch can't handle that. Often it's instead represented as hexadecimal or base64. In the case of image processing, you can then read the image format and do whatever you want, such as drawing the pixels with pen. An example of a complete project with such functionality is my Image Editor.
Minimal processing of the image data in Scratch can be achieved if you directly externally extract the pixel values. These can be stored in lists or variables in Scratch.
It has the downside of being inefficient with storage (being uncompressed), and I've done a lot of work on better alternatives (although are a bit harder to understand). I developed an text-based image format compatible with Scratch along with the tools required to convert it from common binary formats. This is just an extra step, ultimately the pixel values are decoded in Scratch to end up in lists.
—
It can be done in vanilla Scratch if you can get the image data into it. Images are usually binary formats and Scratch can't handle that. Often it's instead represented as hexadecimal or base64. In the case of image processing, you can then read the image format and do whatever you want, such as drawing the pixels with pen. An example of a complete project with such functionality is my Image Editor.
Minimal processing of the image data in Scratch can be achieved if you directly externally extract the pixel values. These can be stored in lists or variables in Scratch.
It has the downside of being inefficient with storage (being uncompressed), and I've done a lot of work on better alternatives (although are a bit harder to understand). I developed an text-based image format compatible with Scratch along with the tools required to convert it from common binary formats. This is just an extra step, ultimately the pixel values are decoded in Scratch to end up in lists.
- Discussion Forums
- » Advanced Topics
-
» extracting sprites from spritesheets within scratch