lbrndnr / lbgifimage Goto Github PK
View Code? Open in Web Editor NEWThis is a small category that creates an animated UIImage out of a gif image.
Home Page: http://laurinbrandner.ch
License: MIT License
This is a small category that creates an animated UIImage out of a gif image.
Home Page: http://laurinbrandner.ch
License: MIT License
If you run Product > Analyze in XCode you should see it report a memory leak in UIImage+GIF.m
The CFDictionary returned by CGImageSourceCopyPropertiesAtIndex is owned by your code but never released:
NSDictionary* frameProperties = (__bridge NSDictionary*)CGImageSourceCopyPropertiesAtIndex(source, i, NULL);
This explains ownership:
https://developer.apple.com/library/mac/#documentation/CoreFOundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html
I think there are 2 options:
Use CFBridgingRelease to transfer ownership to ARC (requires ARC)
NSDictionary* frameProperties = CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(source, i, NULL));
Explicitly release frameProperties after you are done with it (requires that ARC be disabled for the file)
NSDictionary* frameProperties = CFBridgingRelease(CGImageSourceCopyPropertiesAtIndex(source, i, NULL));
duration += [[[frameProperties objectForKey:(NSString*)kCGImagePropertyGIFDictionary] objectForKey:(NSString*)kCGImagePropertyGIFDelayTime] doubleValue];
[frameProperties release];
I think the computed duration in animatedGIFWithData is incorrect.
NSTimeInterval has a unit of seconds and kCGImagePropertyGIFDelayTime has a unit of milliseconds.
I think you need to divide kCGImagePropertyGIFDelayTime by 1000 before adding it to duration.
I tried to use LBGIFImage in ARC by using "-fno-objc-arc" option but failed.
The error message is below:
Undefined symbols for architecture i386:
"_CGImageSourceCreateWithData", referenced from:
+[UIImage(GIF) animatedGIFWithData:] in UIImage+GIF.o
"_CGImageSourceCopyProperties", referenced from:
+[UIImage(GIF) animatedGIFWithData:] in UIImage+GIF.o
"_CGImageSourceGetCount", referenced from:
+[UIImage(GIF) animatedGIFWithData:] in UIImage+GIF.o
"_CGImageSourceCreateImageAtIndex", referenced from:
+[UIImage(GIF) animatedGIFWithData:] in UIImage+GIF.o
"_kCGImagePropertyGIFDelayTime", referenced from:
+[UIImage(GIF) animatedGIFWithData:] in UIImage+GIF.o
"_kCGImagePropertyGIFDictionary", referenced from:
+[UIImage(GIF) animatedGIFWithData:] in UIImage+GIF.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
If there is some way to use this library in ARC, please tell me.
I’ve recently added LBGIFImage to the CocoaPods package manager repo.
CocoaPods is a tool for managing dependencies for OSX and iOS Xcode projects and provides a central repository for iOS/OSX libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.
However, <LBGIFImage>
doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.
Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.
In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:
$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags
Hi.
I have one question.
I am using SDWebImage 3.8.2.
SDWebImage of version 3.8.2 uses LBGIFImage of version 0.0.1.
LBGIFImage of version 0.0.1 is the version before LICENSE notation is modified,
but can I interpret this as LICENSE same as version 0.1 and use it?
I needed to modify this library
from
[images addObject:[UIImage imageWithCGImage:image]];
to
[images addObject:[UIImage imageWithCGImage:image scale:[UIScreen mainScreen].scale orientation:UIImageOrientationUp]];
to work on Retina display.
Hi:
Since the copyright that has been described in these file is in the unknown, I want you to describe the correct copyright
https://github.com/larcus94/LBGIFImage/blob/master/LBGIFImage/UIImage%2BGIF.h#L6
https://github.com/larcus94/LBGIFImage/blob/master/LBGIFImage/UIImage%2BGIF.m#L6
Although this code is what is used in SDWebImage
https://github.com/rs/SDWebImage/blob/3.7.5/SDWebImage/UIImage%2BGIF.h#L6
https://github.com/rs/SDWebImage/blob/3.7.5/SDWebImage/UIImage%2BGIF.m#L6
because the Copyright has become unclear, I think that dangerous as a license.
If described the copyright in this code, we wanted to also fixes SDWebImage side.
thank you.
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.