mattt / animatedgifimageserialization Goto Github PK
View Code? Open in Web Editor NEWComplete Animated GIF Support for iOS, with Functions, NSJSONSerialization-style Class, and (Optional) UIImage Swizzling
License: MIT License
Complete Animated GIF Support for iOS, with Functions, NSJSONSerialization-style Class, and (Optional) UIImage Swizzling
License: MIT License
This is a great library, but it can't be used on OSX anymore, because the library of Mobile Services Core can't be found.
Is there a reason why AFNetworking methods doesn't support this library?
I tried with the UIImageView+AFNetworking methods like
[imageView setImageWithURLRequest:req placeholderImage:[UIImage imageNamed:@"placeholder.gif"] ....
The placeholder works but the downloaded image (a GIF) is not animated.
Do i have to do anything special?
[After further testing I am seeing strange behaviour, and am withdrawing this post pending further investigation. Although the Apple documentation says that frameDuration should be supplied as centiseconds, in fact supplying it as seconds DOEs work in some cases. But there are other cases where it does not. e.g. frameDuration of 0.25 and 0.5 work, but frameDuration of 0.41666666 does not].
When setting property kCGImagePropertyGIFDelayTime, the required unit is one hundredths of a second, but the code is currently setting the value in seconds.
However, even after applying the following amendment, I'm still apparently not able to control the speed of the generated GIF - regardless of the duration value I choose, whenever I display the GIF, it runs at a fast (default?) frame rate.
NSDictionary *frameProperties = @{
(__bridge NSString *)kCGImagePropertyGIFDictionary: @{
(__bridge NSString *)kCGImagePropertyGIFDelayTime: @(frameDuration*100.0)
}
};
Hi,
Under some circumstances, Xcode's Memory Leaks Instrument seems to report leaks when using AnimatedGIFImageSerialization in combination with Crashlytics. I don't know if those are actual leaks or not. All of these have in common Crashlytics and AnimatedGIFImageSerialization:
The leaks seem to go away if you replace AnimatedGIFImageSerialization's swizzling by JRSwizzle, which seems to be safer for subclassing and inheritance:
[self jr_swizzleMethod:@selector(imageNamed:) withMethod:@selector(animated_gif_imageNamed:) error:nil];
[self jr_swizzleMethod:@selector(imageWithData:) withMethod:@selector(animated_gif_imageWithData:) error:nil];
[self jr_swizzleMethod:@selector(imageWithData:scale:) withMethod:@selector(animated_gif_imageWithData:scale:) error:nil];
[self jr_swizzleMethod:@selector(imageWithContentsOfFile:) withMethod:@selector(animated_gif_imageWithContentsOfFile:) error:nil];
[self jr_swizzleMethod:@selector(initWithContentsOfFile:) withMethod:@selector(animated_gif_initWithContentsOfFile:) error:nil];
[self jr_swizzleMethod:@selector(initWithData:) withMethod:@selector(animated_gif_initWithData:) error:nil];
[self jr_swizzleMethod:@selector(initWithData:scale:) withMethod:@selector(animated_gif_initWithData:scale:) error:nil];
I am seeing an out of memory exception when trying to display a 3x GIF with 500 frames. I think it has something to do with the size of the mutableImages array.
This is a good project.
Can I save the encoded gif image to the photo library?
UIImage *gifImage = UIImageWithAnimatedGIFData(data);
UIImageWriteToSavedPhotosAlbum(gifImage, nil, nil, nil);
This code not work. Pls give a hand. Thanks
It looks like the tag needs to be bumped. The issue I reported below was fixed in master some years ago.
Issue I initially reported:
If you include the library and use -imageWithData:scale
on a non-gif it ignores scale entirely.
If you use AFNetworking and set your imageResponseSerializer's imageScale
property and use AFNetworking's UIImageView -setImageWithURL
to retrieve a gif, it will ignore scale here as well.
I get a exception with endless loop when AnimatedGIFImiageSerialization is imported in classes that are used in unit tests.
The loop happens with this method: + (UIImage *)animated_gif_imageNamed:(NSString *)name attribute((objc_method_family(new))) {
Do you see any possibility of this approach working for a UITextView rendering an image inside of attributed text?
Thanks
重复进入界面播放gif图片 会导致内存暴增 应用闪退
In the .m file, on line 71 I get a warning: "The code will never be executed". Please clean the code, because the warnings are very uncomfortable.
AnimatedGIFImageSerialization' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture armv7
Might be outside the scope of this project as you'd need to manually update UIImageView
image contents using e.g. an NSTimer
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.