Discuss Scratch

creeperyeettt
Scratcher
500+ posts

Support for webp files

Gamer_Logan819 wrote:

hydrofungus wrote:

creeperyeettt wrote:

where are you getting thumbnails?
Wdym? There are no thumbnails here

OhOkSir12345 wrote:

No support

Its not that hard to convert webp images to pngs if your on a chromebook just remame the file from “Balling.webp to Balling.png”
Chromebook??? Not everyone uses chromebooks
I think it works on windows too.
it does not work on windows or mac
SMASH-ULTIMATE-FAN
Scratcher
100+ posts

Support for webp files

creeperyeettt wrote:

Gamer_Logan819 wrote:

hydrofungus wrote:

creeperyeettt wrote:

where are you getting thumbnails?
Wdym? There are no thumbnails here

OhOkSir12345 wrote:

No support

Its not that hard to convert webp images to pngs if your on a chromebook just remame the file from “Balling.webp to Balling.png”
Chromebook??? Not everyone uses chromebooks
I think it works on windows too.
it does not work on windows or mac
huh, didn't know I could do that Xd but still, we should get WEBP file support

Last edited by SMASH-ULTIMATE-FAN (April 25, 2024 17:03:50)

MagicCoder330
Scratcher
1000+ posts

Support for webp files

You can get viruses if you download WebP files, so this would be a large security hole. Bad idea.

before you ask for “source?” both Digital Trends and PC world state it. Not sure if they are true, though. Nevertheless probably not good to take the risk.
-OctoSquid-
Scratcher
100+ posts

Support for webp files

MagicCoder330 wrote:

You can get viruses if you download WebP files, so this would be a large security hole. Bad idea.

before you ask for “source?” both Digital Trends and PC world state it. Not sure if they are true, though. Nevertheless probably not good to take the risk.
Pretty sure that has been fixed, as stated in this article
MagicCoder330
Scratcher
1000+ posts

Support for webp files

-OctoSquid- wrote:

MagicCoder330 wrote:

You can get viruses if you download WebP files, so this would be a large security hole. Bad idea.

before you ask for “source?” both Digital Trends and PC world state it. Not sure if they are true, though. Nevertheless probably not good to take the risk.
Pretty sure that has been fixed, as stated in this article

Ah, I see. Then, this may be an OK suggestion. However, there's no way to tell if they have more problems and they already had one so far. I don't trust them personally because of this but I know it isn't the most valid reason.

As long as they are checked as they are uploaded then this should be OK to add.
busybuddie1234
Scratcher
100+ posts

Support for webp files

Bring
Up
My
Post
SMASH-ULTIMATE-FAN
Scratcher
100+ posts

Support for webp files

OhOkSir12345 wrote:

Picoguy wrote:

OhOkSir12345 wrote:

No support

Its not that hard to convert webp images to pngs if your on a chromebook just remame the file from “Balling.webp to Balling.png”
What are the downsides to supporting webp?
Probably none but its not really that hard to convert an image to a png just put the webp image in and then you get the png that you need, super simple
Me, on a school chromebook, where image converter sites are blocked for some nonsensical reason:
asdfperson135
Scratcher
500+ posts

Support for webp files

SMASH-ULTIMATE-FAN wrote:

OhOkSir12345 wrote:

Picoguy wrote:

OhOkSir12345 wrote:

No support

Its not that hard to convert webp images to pngs if your on a chromebook just remame the file from “Balling.webp to Balling.png”
What are the downsides to supporting webp?
Probably none but its not really that hard to convert an image to a png just put the webp image in and then you get the png that you need, super simple
Me, on a school chromebook, where image converter sites are blocked for some nonsensical reason:
Chromebooks actually have a neat thing where you can just rename the .webp ending to .png and it acts as a built in converter (which is exactly what they said)

Last edited by asdfperson135 (May 11, 2024 02:48:23)

julmik6478
Scratcher
500+ posts

Support for webp files

Support beacuse why not? I used converters like convertino and now I don't need to use it.
julmik6478
Scratcher
500+ posts

Support for webp files

MagicCoder330 wrote:

You can get viruses if you download WebP files, so this would be a large security hole. Bad idea.

before you ask for “source?” both Digital Trends and PC world state it. Not sure if they are true, though. Nevertheless probably not good to take the risk.
You can get virus dowloading anything and scratch team don't risk about you dowloaded image or music with virus.
julmik6478
Scratcher
500+ posts

Support for webp files

cookieclickerer33 wrote:

Semi support, scratch not supporting webp and all google images being webp encourages kids to make their own art and not steal art and get into potential legal issues. But most images being webp also just makes it harder than it needs to be
If scratch “encourages kids to make their own art and not steal art” so why importing images from files even exist?
SMASH-ULTIMATE-FAN
Scratcher
100+ posts

Support for webp files

asdfperson135 wrote:

SMASH-ULTIMATE-FAN wrote:

OhOkSir12345 wrote:

Picoguy wrote:

OhOkSir12345 wrote:

No support

Its not that hard to convert webp images to pngs if your on a chromebook just remame the file from “Balling.webp to Balling.png”
What are the downsides to supporting webp?
Probably none but its not really that hard to convert an image to a png just put the webp image in and then you get the png that you need, super simple
Me, on a school chromebook, where image converter sites are blocked for some nonsensical reason:
Chromebooks actually have a neat thing where you can just rename the .webp ending to .png and it acts as a built in converter (which is exactly what they said)
True, but what if someone was on a school computer without that feature, they would be out of luck without webp image support
creeperyeettt
Scratcher
500+ posts

Support for webp files

some scratch users dont use chromebooks, and a lot of images are WEBP, ecispecially if its from google
busybuddie1234
Scratcher
100+ posts

Support for webp files

bump
SMASH-ULTIMATE-FAN
Scratcher
100+ posts

Support for webp files

Honestly, I´m surprised that Scratch doesn´t already have Webp image support. It would be extremely easy to implement. I think. Don´t quote me on that if it isn´t
TheTheory_OfFire
Scratcher
12 posts

Support for webp files

Yes, I try always to find good images, but literally all of them are webp and I cannot filter them out because you cannot sort by image file type on Google and Google is my preferred search engine. Also I use a Windows PC so I have to do complicated settings and properties if i do not want to convert them.

Last edited by TheTheory_OfFire (July 15, 2024 17:19:14)

BigNate469
Scratcher
1000+ posts

Support for webp files

TheTheory_OfFire wrote:

Yes, I try always to find good images, but literally all of them are webp and I cannot filter them out because you cannot sort by image file type on Google and Google is my preferred search engine. Also I use a Windows PC so I have to do complicated settings and properties if i do not want to convert them.
Actually, you can. It just requires that you use Google Advanced Search, rather than just typing something into a search bar and hitting enter/return.

Last edited by BigNate469 (July 15, 2024 20:21:57)

MagentaDude1359
Scratcher
100+ posts

Support for webp files

support, it's annoying when you download an image, try to import it, realize it doesn't work, rename the file extension, and import it again.

creeperyeettt wrote:

(renaming the file extension) does not work on windows or mac
no, i have a mac, renaming the file extension works on it.

Last edited by MagentaDude1359 (July 17, 2024 19:43:19)

mythicalenergy45
Scratcher
17 posts

Support for webp files

Just rename the file it's not that hard!
You might think you've peeped the scene
You haven't, the real one's far too mean
The watered-down one, the one you know
Was made up centuries ago
They made it sound all wack and corny
Yes, it's awful blasted boring
Twisted fictions, sick addiction
Well, gather 'round, children, zip it, listen
___a__-a___a___a-_--
New Scratcher
37 posts

Support for webp files

Here are the exact steps to implement this feature:

1. Change the following at “scratchfoundation/scratch-gui/src/containers/costume-tab.jsx”, line #285
-fileAccept: '.svg, .png, .bmp, .jpg, .jpeg, .gif',
+fileAccept: '.svg, .png, .bmp, .jpg, .jpeg, .gif, .webp',
2. Repeat step #1 at “scratchfoundation/scratch-gui/src/components/sprite-selector/sprite-selector.jsx”, line #123

3. Repeat step #1 at “scratchfoundation/scratch-gui/src/components/stage-selector/stage-selector.jsx”, line #105

4. Create the following file at “scratchfoundation/scratch-gui/src/lib/webp-converter.js” and add the following
export default webpImage => new Promise(resolve => {
    const imageUrl = webpImage instanceof String ?
    webpImage :
        window.URL.createObjectURL(new Blob([webpImage], {type: 'image/webp'}));
    
    const canvas = document.createElement('canvas');
    const ctx = canvas.getContext('2d');
    const image = document.createElement('img');
    image.addEventListener('load', () => {
        canvas.width = image.naturalWidth;
        canvas.height = image.naturalHeight;
        ctx.drawImage(image, 0, 0);
        const dataUrl = canvas.toDataURL('image/png');
        window.URL.revokeObjectURL(imageUrl);
        resolve(dataUrl);
    });
    image.setAttribute('src', imageUrl);
});
This is to maintain standards with the rest of the codebase, but this could easily be combined with “scratchfoundation/scratch-gui/src/lib/bmp-converter.js” (yes, Scratch lets you upload BMPs)

5. Add the following at “scratchfoundation/scratch-gui/src/lib/file-uploader.js”, line #4
import {BitmapAdapter, sanitizeSvg} from 'scratch-svg-renderer';
import randomizeSpritePosition from './randomize-sprite-position.js';
import bmpConverter from './bmp-converter';
- import gifDecoder from './gif-decoder';
+ import webpConverter from './webp-converter'
+ import gifDecoder from './gif-decoder';
6. Add the following below line #124 in the same file, “scratchfoundation/scratch-gui/src/lib/file-uploader.js”
+    case 'image/webp': {
+        webpConverter(fileData).then(dataUrl => {
+            costumeUpload(dataUrl, 'image/png', storage, handleCostume);
+        });
+        return;
+    }
Tada, you most likely have implemented .webp file uploading in probably about 10 minutes!

Powered by DjangoBB