Pages: 1
Topic closed
I am trying to modify the Scratch source code, so it would be possible to generate a .png thumbnail image from a sprite, or a project.
The reason why I am trying this, is the following:
- it could be useful to extract thumbnails from sprites for uploading them to my scratch resources website.
- Exporting thumbnails from project would be useful if it could work automatically, for automatic thumbnail generation for discScratchr
I found thumbnail loading (I think) in the source code, at
"Scratch-UI-Dialogs; ThumbnailCache; other"
Could anyone please help me on this? I just don't know enough squeak...
Thanks, Joren
Offline
I would love to have a PHP version that extracts thumbnails from from an .sb project! I haven't had enough time to work on it but it would help us a lot.
If there are any PHP expert programmers out there that would like to volunteer please contact us.
Offline
*** bump, i'm still seeking for feedback
***
Andres, actually I was not trying to use PHP. I was looking for a way to do this with the Scratch source code, so it copuld be used to create thumbnails on a discScratchr disc ...
Joren
Offline
Great idea JSO!
The code you probably found in class ThumbnailCache's instance method thumbnailFromSpriteData: aByteArray should get you going pretty well. It doesn't seem to rely on anything in class ThumbnailChache, so you can just copy it into you own class or into another method somewhere else. You can play around with the dimensions of the thumbnail it creates (e.g. to make it larger or smaller). This code answers an instance of class Form, and you'll find methods in class Form to store it in any file format you need (GIF, PNG, JPEG, BMP).
Another thing which might be worth considering for your site would be to let it create thumbnails of each of a sprite's costumes (not just the active one), so to even better showcase all of a sprite's resources ...
Offline
Topic closed
Pages: 1