This site requires JavaScript, please enable it in your browser!
Greenfoot back
SwaggyXiao
SwaggyXiao wrote ...

2021/1/22

Image scale issue

SwaggyXiao SwaggyXiao

2021/1/22

#
Hi, I am facing a problem about Image.scale. Basically, I have a Minecraft dirt image with side 12*12 pixel. I want to make it to 60*60 pixel, so i do scale(60,60). It works pretty well in the local greenfoot, the image is super clear. However, when I upload the image to greenfoot website, it gets super unclear. So... how do i fix that issue? The example is in my game "I wanna play Minecraft", and it has source code. Thank you!
danpost danpost

2021/1/22

#
Save original image at (60, 60) and avoid using scale.
SwaggyXiao SwaggyXiao

2021/1/23

#
yes I tried it and it results in the same problem, I use MacOS, where if I scale my image on my current image editor "preview", it shows the same thing as the greenfoot website. If there are no other ways I may have to probably find an online image editor? but even that it may result in the whole greenfoot file size may be too large, since imagine Minecraft has many image files LOL
MrCohen MrCohen

2021/1/23

#
First, I agree with danpost - don't use scale for this. Scale has issues on the Gallery - I had the same experience trying to use it with my shapes-3d game thing. It's also a lot of CPU work to do, which can slow stuff down on the Gallery. Use a good image editor program - not Preview. I'm guessing that your image is a JPG and when Preview increases the size, compression makes it look like garbage, whereas when Greenfoot scales it locally, it leaves all of the pixels intact. You might just be able to tell Preview to save as a png, and then increase the size, or you could find a better image editor program.
SwaggyXiao SwaggyXiao

2021/1/23

#
OMG MR COHEN!!!! YES! I FIND THAT ONE POTENTIAL REASON MY PROGRAM CRASH IS BECAUSE I DO SCALING 10000 TIMES ON THE CONSTRUCTER. PNG SCALING DOES NOT WORK WELL ON PREVIEW LOL SO PROBABLY I NEED TO FIND ANOTHER TOOL! OMG WHY YOU ARE ON GREENFOOT WEBSITE ALL THE TIME HAHAHAHAHAH!
You need to login to post a reply.