Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zadr/clicktogif
A NSOperation subclass that builds a UIImage out of the first frame of an animated GIF.
https://github.com/zadr/clicktogif
Last synced: about 1 month ago
JSON representation
A NSOperation subclass that builds a UIImage out of the first frame of an animated GIF.
- Host: GitHub
- URL: https://github.com/zadr/clicktogif
- Owner: zadr
- License: bsd-2-clause
- Created: 2013-09-24T02:17:08.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2015-10-28T23:05:42.000Z (about 9 years ago)
- Last Synced: 2024-10-16T02:56:17.206Z (3 months ago)
- Language: Objective-C
- Size: 3.51 MB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Download the first frame of an animated gif, instead of the full thing.
example usages:
```swift
func example() {
let url = NSBundle.mainBundle().URLForResource("puppy", withExtension: "gif")!
let operation = CQIntroductoryGIFFrameOperation(URL: url)// note: `completionBlock` is also available from NSOperation, although it
// works based off of KVO states, and will take an extra runloop or two to fire.
operation.target = self
operation.action = "gifProcessed:"NSOperationQueue.mainQueue().addOperation(operation)
}@objc func gifProcessed(operation: CQIntroductoryGIFFrameOperation) {
if let image = operation.introductoryFrameImageData {
print("we have a still image of the first frame of an animated gif!")
}
}
```or
```swift
func example() {
let url = NSBundle.mainBundle().URLForResource("puppy", withExtension: "gif")!
let operation = CQIntroductoryGIFFrameOperation(URL: url)
operation.completionBlock = {
if let image = operation.introductoryFrameImageData {
print("we have a still image of the first frame of an animated gif!")
}
}NSOperationQueue.mainQueue().addOperation(operation)
}
```(Or go straight to the code, in CQIntroductoryGIFFrameOperationHarness/CQIntroductoryGIFFrameOperation{.h, .m}.)