wangjwchn / aimage Goto Github PK
View Code? Open in Web Editor NEWAn animated gif & apng engine for iOS in Swift. Have a great performance on memory and cpu usage.
An animated gif & apng engine for iOS in Swift. Have a great performance on memory and cpu usage.
var frameProperties = [CFDictionary]()
if(imageProperty.imageType == ImageType.Gif){
frameProperties = imageProperties.map(){
let propertyGIFDic = CFDictionaryGetValue($0,unsafeAddressOf(kCGImagePropertyGIFDictionary))
return unsafeBitCast(propertyGIFDic,CFDictionary.self)
}//gif
}
else if(CFDictionaryContainsKey(imageProperties[0],unsafeAddressOf(kCGImagePropertyPNGDictionary))){
frameProperties = imageProperties.map(){
unsafeBitCast(CFDictionaryGetValue($0,unsafeAddressOf(kCGImagePropertyPNGDictionary)),CFDictionary.self)
}//apng
}
Multiple commands produce '/Users/zss/Library/Developer/Xcode/DerivedData/GifTest-bpfttbarcugddsfbqavvzsqcrckt/Build/Products/Debug-iphonesimulator/AImage/AImage.framework/Info.plist'
I have know idea what I'm doing wrong but it's crashing since swift 4.1
` }
let frameDelays: [Float] = frameProperties.map() {
var delayObject: AnyObject = unsafeBitCast(CFDictionaryGetValue($0, Unmanaged.passUnretained(kCGImagePropertyGIFUnclampedDelayTime).toOpaque()), to: AnyObject.self)
if (delayObject.floatValue == 0.0){
delayObject = unsafeBitCast(CFDictionaryGetValue($0, Unmanaged.passUnretained(kCGImagePropertyGIFDelayTime).toOpaque()), to: AnyObject.self)
}
return delayObject as! Float // <-- error occurs here
}
return frameDelays
}`
swift4.0 版,播放完一次gif之后会像闪光灯一样闪烁1秒
Hi.
There was no problem with Swift 4.0 but on Swift 4.1 on timerFired() func there is a crash on this line:
`let nextAt = ((self.indexAt)+1)%(self.aImage!.displayIndex.count)`
and it says:
Fatal error: Remainder of division by zero
Have setted all parameter as Readme File specified, in the moment of excecution at line 61 AImage.swift file occurs EXC_BAD_ACCESS trying check CFDictionaryContainsKey(imageProperties[1],unsafeAddressOf("{GIF}"))
In one of my previous PR I had put a stopGIF()
function. This allows for UIViewController
that stays in the view hierarchy. For instance in the case of an UINavigationController
push, it allows to stop GIFs in the viewDidDisappear
, which prevent undisplayed GIFs to hog on the CPU.
An even better way would be to automatically stop any GIF that is not displayed.
Hi, I'd like to inquire about the app's performance in general. I understand it slows down the view it's in, but it currently seems to be affecting the entire app (I have an iCarousel running in the main View).
I have a single apng sitting in my SettingsViewController and display it in the footer view of the table. It's loaded with imageview.APlay();. Do I need to somehow use iamgeview.AStop(); in order for it not to affect the rest of the app? I understand this is a noob question, I'm just slightly confused by how slow the entire app has become all of a sudden.
Thanks a bunch!
I've tried AImage using Cocoapods and:
Using :git => "https://github.com/wangjwchn/AImage.git" on Podfile results a empty installation.
Can you fix it?
Thanks!
I have a two-frame gif and only the first frame shows. With a three-frame gif only two frames animate back and forth. One frame is being dropped. I think it has something to do with the displayIndex
array on AImage
, but I can't understand the logic in the calculateFrameDelay
function well enough to figure out exactly what is causing the issue.
fatal error: unexpectedly found nil while unwrapping an Optional value
JWAnimatedImageView.Swift Line 74 -> _cacheKey
is nil...
I'd be cool to also add Cocoapods support. I done this implementation myself last week for my library. Just follow this post and this checklist.
Lemme know if you need any help! 😄
Please start your method names with a lowercase letter. That hurts.
Not really a code issue, really a documentation/README issue. Your README says this code hasn't been updated since April 2016 but of course it has. Also, FLAnimatedImage has had issues (or reported issues) with iOS 10. Have you tested with iOS10 yet? if you would just update the README you can then delete or close this issue.
Thanks for creating this repository!
It's will be great to add Carthage support
You can follow this tutorial: Making Carthage-compatible Frameworks with Swift
i did set imageView on collectionViewCell and i have data.
so there is serveral cells.
i played gif more and more.
gif spped getting faster.
Hey @wangjwchn, thanks for open sourcing this! I was using FLAnimatedImage
in a project several weeks ago and had to abandon GIF support because of the memory issues. Although in Xcode it would show never ending memory growth, I wasn't experiencing an actual memory leak, it was just that the caching system they had implemented was poor and was causing really high transient counts in Instruments.
I would love to run some tests and compare JWAnimatedImage's
transient counts to FLAnimatedImage's.
When using GIFs on a UICollectionView
cell that is reused, the framerate does increase exponentially. A great addition would be to set a maximum framerate.
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.