Donaldcwl / browser-image-compression

Image compression in web browser
MIT License
1.3k stars 160 forks source link

Unknown error #47

Closed Madeorsk closed 4 years ago

Madeorsk commented 4 years ago

When I try to use imageCompression, I get a very strange error.

Thrown error

My code is the easiest I can write:

imageCompression(file, {
    maxSizeMB: 10,
}).then((compressedFile) => {
    console.log("ok");
}).catch((error) => {
    console.log(error);
});

EDIT: Looks like it happens only on a specific image file... I think that it's corrupted which is very strange because all other softwares can open it.

Donaldcwl commented 4 years ago

Can you upload that image for us to reproduce it?

Madeorsk commented 4 years ago

I can display it in Eye Of Gnome, sometimes in Firefox / Chromium (it doesn't work here but in some cases the image was shown). I think you don't need to take my issue in account as it is not a normal state for an image file.

something is broken?

Madeorsk commented 4 years ago

Oh OK I just found why. When I tried to open this image in Glimpse (~GIMP), it asked me how to import it as an SVG file. So I opened it in an editor and... It is an SVG file! I don't know why the extension was PNG... Sorry!