Comments (14)
Yeah, it would be nice to see the support of animated files.
from webp-wrapper.
Ditto. Could really use it.
from webp-wrapper.
Please, give me more details.
Load animated WebP into ¿....?
Convert animated WebP to ¿...?
from webp-wrapper.
With the version defined here, I've this error:
With any WebP animated image.
Actually, with the last commited version, there is no error but there is no image displayed.
Neverless, I can get file information:
from webp-wrapper.
In the new version, the DLL suport animated WebP.
But it is trying to decode and render in an image (a windows bitmap).
Bitmaps are static, so they will hardly be able to present a moving image. In addition, the windows form control does not support animations either.
So the question is, what do you want that webP to become? Where do you want to present it? What container do you want to send it to?
from webp-wrapper.
It does not need to handle the animation.
Ideally, we should be able to get every frame.
By their index for example.
from webp-wrapper.
As Lacro59 said, just be able to get every frame in a manner similar to the way an animated GIF is converted to an Image. In other words, I'd like an Image/Bmp that can be played using the System.Drawing.ImageAnimator.Animate(Image, EventHandler) Method.
See the example in https://docs.microsoft.com/en-us/dotnet/api/system.drawing.imageanimator.animate?view=windowsdesktop-5.0
I found an example showing how to create a multi-frame Bitmap here: https://docs.microsoft.com/en-us/windows/win32/gdiplus/-gdiplus-creating-and-saving-a-multiple-frame-image-use . Rather than saving to a file, you'd probably want to save to a .MemoryStream
from webp-wrapper.
I need this too. Actually I would love to be able to throw a WEBP file into this library and be returned an object with a list of images. If the webp file is not an animation then there will only be 1 image in the images collection. There could also be like an IsAnimated property.
Im sure there are a bunch of other information about the file that can be returned as well. Like if animated then some info on framerate or something like that.
This would be awesome to have for sure.
from webp-wrapper.
from webp-wrapper.
FWIW, I ended up using Magick.NET to convert WebP images to PNG's (single frame) or GIF's (animated). My code looks like:
public static Bitmap NewBitmap(this FileInfo fi) {
Bitmap bitmap = null;
try {
bitmap = new Bitmap(fi.FullName);
} catch (Exception) {
// use 'MagickImage()' if you want just the 1st frame of an animated image.
// 'MagickImageCollection()' returns all frames
using (var magickImages = new MagickImageCollection(fi)) {
var ms = new MemoryStream();
if (magickImages.Count > 1) {
magickImages.Write(ms, MagickFormat.Gif);
} else {
magickImages.Write(ms, MagickFormat.Png);
}
bitmap?.Dispose();
bitmap = new Bitmap(ms);
// keep MemoryStream from being garbage collected while Bitmap is in use
bitmap.Tag = ms;
}
}
return bitmap;
}
from webp-wrapper.
FWIW, I ended up using Magick.NET to convert WebP images to PNG's (single frame) or GIF's (animated). My code looks like:
public static Bitmap NewBitmap(this FileInfo fi) { Bitmap bitmap = null; try { bitmap = new Bitmap(fi.FullName); } catch (Exception) { // use 'MagickImage()' if you want just the 1st frame of an animated image. // 'MagickImageCollection()' returns all frames using (var magickImages = new MagickImageCollection(fi)) { var ms = new MemoryStream(); if (magickImages.Count > 1) { magickImages.Write(ms, MagickFormat.Gif); } else { magickImages.Write(ms, MagickFormat.Png); } bitmap?.Dispose(); bitmap = new Bitmap(ms); // keep MemoryStream from being garbage collected while Bitmap is in use bitmap.Tag = ms; } } return bitmap; }
This works. But it takes a while to load the webp files. My browser can quickly load the same files. Maybe chrome is just optimized for webp files. Also they play at different framerates too.
Thanks for posting.
from webp-wrapper.
Still no support for animated webp?
There doesn't seem to be any wrapper that handles them yet this one suggests being "the most complete wrapper", unfortunate.
Even Google's own decoding app doesn't support animated webp lol
from webp-wrapper.
from webp-wrapper.
I've been using Magick.NET to convert WebP images animated GIFs for about 6 months - see my code example above. It's not super fast, but works well.
Also, the framerate issue that holm76 mentioned may have been fixed in the latest release of Magick.NET, see dlemstra/Magick.NET#1102
from webp-wrapper.
Related Issues (20)
- Converting PNG to WebP , Background Get Change HOT 3
- Adding method to set webp metadata like comment, keywords and etc HOT 1
- image with transparency does not work correctly HOT 3
- Presets settings don't work HOT 1
- Where is BGRA methods HOT 2
- Suggestion : Change licence to LGPL HOT 2
- add refrence HOT 1
- How to build libwebp-1.1.0 cpp code to .dll HOT 1
- Parameter is not valid at webp.Decode(byte[], WebPDecoderOptions) HOT 3
- License HOT 2
- type_mismatch of return_value from DLL HOT 2
- Can't load saved WEBP file
- Webp decode to Stream
- System.NullReferenceException in UnsafeNativeMethods.OnCallback HOT 4
- Question for using in ASP.NET Web Application HOT 2
- wrapper code for decoding animated webp HOT 1
- WebP-wrapper HOT 1
- Wrapper source code available? HOT 1
- Where do I put the DLL files in an ASP.NET application HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webp-wrapper.