Giter VIP home page Giter VIP logo

Comments (16)

dreampiggy avatar dreampiggy commented on June 15, 2024

when I use SDWebImageHEIFCoder decode it, it can not play with animation, the images is nil.

Can you try to use the SDAnimatedImage(data: heicsData) ?

Then check the animatedImage's animationFrameCount ?

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

The HEIFCoder Demo contains a animated HEICS demo, you can have a try and change that into your heics file as well.

Demo code: https://github.com/SDWebImage/SDWebImageHEIFCoder/blob/master/Example/SDWebImageHEIFCoder/SDViewController.m#L24

url: http://nokiatech.github.io/heif/content/image_sequences/starfield_animation.heic

I guess this is some decoding related issue (means, libheif is for blame), not something code logic error.

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

If you can, upload your heics image, and I can ask for libheif's author for help

And, you can also open your heics in Safari on Mac, can Safari show animation ? If not, I guess this maybe the issues in your image file itself, not the coder ?

from sdwebimageheifcoder.

tangxc avatar tangxc commented on June 15, 2024

Thank you for your help.

My heic can not play animated in Safari on My Mac. I had created it by ImageMagick, Maybe it has some errors.

I download this heic image http://nokiatech.github.io/heif/content/image_sequences/starfield_animation.heic . It also can not be played with the code.

NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"starfield_animation" ofType:@"heic"];
NSData *imageData = [NSData dataWithContentsOfFile:imagePath];
UIImage *image = [UIImage sd_imageWithData:imageData]; // image.images = nil
UIImageView *imageView = ...;
imageView.image = image;

SDAnimatedImage *image = [[SDAnimatedImage alloc] initWithData:imageData]; // use this code, image=nil

There is my test heic image's url:
https://github.com/tangxc/resources_repo/blob/main/ll_interaction_heifenc.heic
https://github.com/tangxc/resources_repo/blob/main/ll_interaction_heic.heic

Thanks.

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

How did you store the image file into NSBundle ? Please pay attention now to add that into Assets Catalog (Means, the Assets.car)

Or can you directlly using NSURLSession to download data and do the same testing ?

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

Because as my local machine, I can see the animation in HEIFCoder' demo here.

from sdwebimageheifcoder.

tangxc avatar tangxc commented on June 15, 2024

image
I just dragged it into my project. You mean I need add it into Assets Catalog. I did it as the picture below, load image is nil:
image
image

from sdwebimageheifcoder.

tangxc avatar tangxc commented on June 15, 2024

Because as my local machine, I can see the animation in HEIFCoder' demo here.

Are you use my heic image?

from sdwebimageheifcoder.

tangxc avatar tangxc commented on June 15, 2024

I had run SDWebImageHEIFCoder Example already. The animated HEIC URL still play without animation http://nokiatech.github.io/heif/content/image_sequences/starfield_animation.heic. I don't know what's wrong with it. My test machine is iPhone 12 ProMax, iOS 15.2.

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

Found my comments years ago...Seems libheif does not support HEICs animation ?😂

image

But Apple's ImageIO supports this. You can test the same image using the SDWebImage demo, or change code in AppDelegate.m

// changes these 2 lines into this, which use Apple's ImageIO (close-sourced, OS vendored)
SDImageHEICCoder *AppleHEICoder = [SDImageHEICCoder sharedCoder];
[[SDImageCodersManager sharedManager] addCoder:AppleHEICoder];

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

@tangxc See:
strukturag/libheif#949
strukturag/libheif#377

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

Maybe I can have a test again using the API from libheif like heif_context_get_number_of_top_level_images with your image sample, tomorrow

But I remember 3 years ago, this API for that Nokia animated HEIC ( http://nokiatech.github.io/heif/content/image_sequences/starfield_animation.heic) always return 1....

😣And there are no any animated, loopcount, or other related words in header heif.h. I think, they don't support animation at all.


Yes, even for this starfield_animation.heic, libheif still report only 1 primary image...And no other API about the frame count information:

1

Test on the libheif 1.16.2 (latest actually....) with de265 codec.

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

See: https://www.dirk-farin.net/software/libheif/index.html

libheif decodes and generates all conformant still-image HEIF/AVIF files, including HDR, and uses the color transformation matrices specified in the color profile. The HEIF decoder makes use of libde265. For encoding, x265 is used. AVIF uses either libaom or dav1d for decoding and libaom or rav1e for encoding.

Only Still Image (static), no Image Sequence (animated)

from sdwebimageheifcoder.

tangxc avatar tangxc commented on June 15, 2024

Found my comments years ago...Seems libheif does not support HEICs animation ?😂

image

But Apple's ImageIO supports this. You can test the same image using the SDWebImage demo, or change code in AppDelegate.m

// changes these 2 lines into this, which use Apple's ImageIO (close-sourced, OS vendored)
SDImageHEICCoder *AppleHEICoder = [SDImageHEICCoder sharedCoder];
[[SDImageCodersManager sharedManager] addCoder:AppleHEICoder];

Thank you very much.

I have tried SDImageHEICCoder and found it works, my heic image and the starfield_animation.heic all can play with animation. And the SDImageHEICCoder's API is available with ios 13.0.

from sdwebimageheifcoder.

dreampiggy avatar dreampiggy commented on June 15, 2024

SDImageHEICCoder's is just wrapper for Apple's ImageIO system framework. And it ship with iOS 13+/macOS 11

I didn't find anything in open-source community about the HEIC sequence support. Even Chrome on Mac itself use Apple's ImageIO 😂 (And old version like macOS 10.15 does not support HEIC)

from sdwebimageheifcoder.

tangxc avatar tangxc commented on June 15, 2024

�Maybe it was truth. Thanks again.

from sdwebimageheifcoder.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.