photopea / photopea

Photopea is online image editor
https://www.Photopea.com
7.48k stars 268 forks source link

Bug: can't open animated WEBP and animated HEIC #1125

Closed AndroidDeveloperLB closed 5 years ago

AndroidDeveloperLB commented 5 years ago

Examples here: test.zip

photopea commented 5 years ago

We have no plans to support HEIC format. It is a commercial format and we would have to pay Apple to be able to let users export their work as HEIC. I think HEIC will be never used in practice, as there are better and free formats.

A nice WebP decoder has been developed by @dominikhlbg . Dominik, could you tell us something about your library? What functions should be called? How should we use the RIFF decoder?

AndroidDeveloperLB commented 5 years ago

I see. So HEIC is quite bad. But what about animated WEBP ? I hope it gets supported.

photopea commented 5 years ago

We do support still WebP images (even with transparency), import and export. But not animated WebP yet. @dominikhlbg made a WebP library, but with no description, and it is hard to get in touch with him.

AndroidDeveloperLB commented 5 years ago

Yes. Still nice to see such a tool exists. I tried to open animated GIF, but I couldn't understand how to edit each frame

photopea commented 5 years ago

The work with animations is described here: https://www.photopea.com/learn/animations . Actually, it is quite simple, once you get used to it.

I just realised, that there is no library for creating WEBP animations. It would be quite a lot of work to create such library. I will close it for now.

AndroidDeveloperLB commented 5 years ago

Doesn't Android P have the decoding&encoding of animated WEBP? Or this: https://developers.google.com/speed/webp/docs/api ?

photopea commented 5 years ago

We need a Javascript library, there is no Javascript library for WebP :(

AndroidDeveloperLB commented 5 years ago

I guess converting between the languages would take a lot of work...

AndroidDeveloperLB commented 5 years ago

But why close the issue, though?

photopea commented 5 years ago

Writing a WebP library is a hard task and I doubt somebody will make such library any time soon.

AndroidDeveloperLB commented 5 years ago

Can't you leave it as request, and that some day it might be possible without too much work? Can you at least have a workaround for this? For example, allow to import the animated WEBP into frames, which will be exported to multiple images when trying to save?

photopea commented 5 years ago

Hi, I fixed it. Now, you can load and save WEBP animations in Photopea. See here: https://www.photopea.com/learn/animations

AndroidDeveloperLB commented 5 years ago

You are full of surprises... Thank you for this.

photopea commented 5 years ago

I managed to do it with Dominiks library and encoding by a browser.

AndroidDeveloperLB commented 5 years ago

@photopea Yes I was wondering how you did it, after you said it's a lot of work. Could HEIC decoding be done though (without encoding)? Or does it also require annoying licenses?

photopea commented 5 years ago

Current HEIC decoders are quite large, it would require adding 1 MB to resources of Photopea (which is quite a lot) ... e.g. WebP decoder is only 60 kB.

Personally, I think we should boycott HEIC, just like Apple boycotted Flash Player on iPhones, so that the humanity switches to open standards instead.

AndroidDeveloperLB commented 5 years ago

@photopea Wow what are they doing with all of this space... Is there a way to lazy-load it (AKA "by demand")? Meaning that only if the user chooses an HEIC file, it will load this code ? About support of HEIC, I agree. But, Android supports it to some degree:

https://developer.android.com/guide/topics/media/media-formats

jaronwanderley commented 2 years ago

Current HEIC decoders are quite large, it would require adding 1 MB to resources of Photopea (which is quite a lot) ... e.g. WebP decoder is only 60 kB.

Hi @photopea, I really appreciate all your effort on this amazing tool. I would like to know if you could provide an opensource version of your WebP encoder/decoder, like you did with UPNG.js?

photopea commented 2 years ago

@jaronwanderley We use the LibWebP as a decoder in Photopea, which is compiled to WASM : libwebp.zip.

We use Canvas.toDataURL() to encode into WebP, see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

jaronwanderley commented 2 years ago

@jaronwanderley We use the LibWebP as a decoder in Photopea, which is compiled to WASM : libwebp.zip.

We use Canvas.toDataURL() to encode into WebP, see https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL

@photopea I already saw it, the encode using Canvas.toDataURL(), but I can't figure out how to encode a animated WebP, could you show your process or a gist for it?

photopea commented 2 years ago

You can open HEIC now! It is available in a plugin by @hxim . Press Window - Plugins, and choose "JPEG XL, AVIF" plugin. An icon will appear in the right bar, which lets you load HEIC images.

photopea commented 8 months ago

Photopea can open HEIC and JPEG XL files now using File - Open, without any plugins! :)

@AndroidDeveloperLB I see a HEIC file in your ZIP archive, but is it really animated? What software should I use to see the animation?

AndroidDeveloperLB commented 8 months ago

@photopea I think it's from here: http://nokiatech.github.io/heif/examples.html Reach "Image sequences" there. Can be shown on web browser somehow.