jmoenig / Snap

a visual programming language inspired by Scratch
http://snap.berkeley.edu
GNU Affero General Public License v3.0
1.5k stars 744 forks source link

Different Images Act Differently? #3184

Open maryfries opened 1 year ago

maryfries commented 1 year ago

Hi All! BJC Sparks has an image processing activity for which a teacher has tried to add their own images and had issues, and I cannot figure out what's going on. In my debugging attempts, I've discovered that the images the teacher added behave differently than the images we added. For example, if you cut down the length/width of both images, the thumbnail for ours resizes, but not for theirs:

image

Can anyone help me debug this issue?

cymplecy commented 1 year ago

What type of image file are they trying to add (jpg/png/gif/svg)?

What type of image file are you adding (jpg/png/gif/svg)?

Are those costume thumbnails?

jmoenig commented 1 year ago

Hi Mary, I've just looked at that project. I love how you picked up my suggestion from the "Trainer's Thursday" session! But... inspecting this implementation more closely reveals a lot of possible ways in which things can go awry, and also a lot of ways in which it is unnecessarily slow and inefficient. One point at which things can go wrong is when you try to round the coordinates of the pixels you're trying to access. But more generally I'd like to have a look at a concrete picture that doesn't work. If the thumbnail doesn't display correctly it might also be an internal Snap! issue...

maryfries commented 1 year ago

Thank you both for looking into it!

@cymplecy 1) They said they tried both JPG and PNG. 2) I don't know, I didn't build it, and the person who did has moved on. Can we check somehow? 3) Yes, the first costume is the one from the project we built, and the second was imported by the teacher. There is are more of both types of images in the file the teacher posted. After playing around with the teacher's project for a while yesterday, I removed some images and took this screenshot highlighting the issue I'm asking about.

@jmoenig Yes, I wondered about the rounding. I'm not sure the problem is a Snap! issue, but I did find this thumbnail thing interesting, and didn't know what to make if it. If you have any suggestions for how to rebuild the project, I'd love to hear them! :)

jmoenig commented 1 year ago

Mary, when I open that project and look at the "mystery9" costume, everything seems to work fine on my computer, both the thumbnail and also plotting it at various resolutions. Could this be a "works on my machine" issue? 🤔

maryfries commented 1 year ago

Hi Jens, (Nice hat, by the way!) Yes, the mystery1-mystery9 costumes were built in to the project we gave students, and they work for me too. The teacher added the last 5 costumes, some of which work. I think the ones that are bigger than the stage don't work, and that's probably due to the way this is coded. In debugging by cropping the images down, I found this anomaly and thought to share it.