This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-06-21 09:50:43

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Help with Scratch source code: sprite/project thumbnails

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


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#2 2008-06-26 01:03:05

andresmh
Scratch Team at MIT
Registered: 2007-03-05
Posts: 1000+

Re: Help with Scratch source code: sprite/project thumbnails

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.


Andres Monroy-Hernandez | Scratch Team at the MIT Media Lab
on identi.ca and  twitter

Offline

 

#3 2008-07-01 13:59:47

JSO
Community Moderator
Registered: 2007-06-23
Posts: 1000+

Re: Help with Scratch source code: sprite/project thumbnails

*** bump, i'm still seeking for feedback  sad  ***

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


http://oi48.tinypic.com/2v1q0e9.jpg

Offline

 

#4 2008-07-11 10:27:36

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Help with Scratch source code: sprite/project thumbnails

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 ...


Jens Mönig

Offline

 

Board footer