I've been using SDWebImage With swift and my app loads dribble shots, but sometimes when its a GIF it leaks the memory.. can I please know how can I display a GIF but only its first frame showing and a small GIF logo which shows the user its a GIF. So I can prevent memory leaks.
Please mind, I am only 12 and fairly new to iOS Development.
Thanks in Advance
Aryan
Related
In the app I have a UICollectionView with item size so that about ~20 items are visible on the screen at the same time. The content that I want to display in each cell is Gif image downloaded from Giphy / Tenor.
However, I realized that gif files take much more space (and time to load) than the relative mp4 files that both Tenor and Giphy provide for each animated image, which is actually obvious, cause mp4 file format has a compressing logic and stuff like that. Sorry if I use wrong terms.
In order to have list loaded faster I decided to switch using UIImageView with GIF images to AVPlayerLayer, cause mp4 file is like ~10x lighter than GIF image. But I faced with the performance issue similar to what described HERE. The flow is mostly the same, I have 20+ items visible at the same time, but because of hardware limitations it only shows 16 videos. I couldn't find any workaround or any other frameworks that would allow to have more than 16 AVPlayerLayer showing video at the same time.
I'm wondering how WhatsApp application works and handles this logic. It also has GIF selection from Tenor. I already checked and figured out that WhatsApp downloads small video files and not gif images. That's why it loads very fast. But I have no idea how they can show 20+ items at the same time. HERE is how that works in WhatsApp - https://media.giphy.com/media/33E84h3RAVn0vQWZak/giphy.gif. Also, I notices during scroll the small static previews are showing, but I don't see the app making requests for it. Probably they gets a first frame of the gif on the fly without any delays in main thread.
I also tried that, but even if I make every single stuff in background thread and the only line on the main thread is "self.imageView.image = myImage", it anyway is lugging a little bit if I have 8 items in the row for example and scrolling very fast.
I see only 2 possible solutions to have it loads fast (so we definitely need to load mp4 instead of gifs), and scroll smooth and without lugs:
1. WhatsApp uses its own custom Video Core to display video in the UICollectionViewCell .
2. WhatsApp downloads video to speed up the download process but then encodes mp4 file to gif one on the fly and use regular animated UIImageView to show the output gif file. However I was not able to have this flow working very fast without lugging during 'massive' scrolling
Any thoughts on how to implement the same to make it works fast and smooth as in WhatsApp? I'm unable to check how it handles the downloaded info, but for sure it downloads mp4 files and not gif ones.
Is there a more 'best practices' way to implement a rotating image on launch screen? I'm currently using the SwiftGifOrigin library with a gif to accomplish this, and it's working well. (There's nothing else on the screen other than a tap gesture.) Since gifs aren't natively supported, I feel like what I'm doing must be wrong. I created the gif myself with the ffmpeg library and could take some time and implement the graphics programmatically in a carousel, but are there any serious cons to my current implementation?
I have an cordova ios application where I show a different gif upon swipe up and swipe up.
But when I swipe up the first gif the second gif doesn't start playing properly from it's first frame like it should.
Instead the second gif shows the last frame of the second gif first and then only it starts playing.
Please see the attached gif herewith.
Because of this it creates an ugly flicker on each image swipe up on the ipad app.
Could someone please point me out what I am doing wrong or what should I be doing differently to fix this issue ?.
I am tesing using ios 9.1.
I think I have a partial answer.
My problem resulted from splitting one rendered image sequence from After Effects into multiple animated gifs in Photoshop.
I think it must have something to do with the way the images are referenced in the image sequence that messes up the final animated gif. Possibly because it loses information about which images are first or last in the process.
I fixed the problem by rendering each image sequence separately then opening each image sequence in Photoshop and saving them as animated gifs separately as well.
My problem is that I want to show a gif in the UIImageView while downloading a picture from remote server. After I downloaded the picture from remote server, I want this downloaded picture to be shown on the screen.
Without problem, I achieved showing the downloaded picture on the screen, which is not difficult of course. However, I could not achieve displaying a custom preinstalled gif in my local while trying to download that picture. Default ActivityIndicator icon appears while downloading.
I did try a few things but I still could not make it. Is there any suggestion for that ?
I put some pictures:
Before I began to download: UImageView with white background color
After I started to download image for UImageView: default activity indicator
Downloaded image: Which I wanted so.
I just want to replace second picture: Activity indicator with my gif. I hope I am understood.
You cannot play a gif format file in a UIImageView. If you have an array of images, you can ainmate them in the imageView and it will be just like a gif.You can also repeat the animation if you want to.
You need to add UIImage+animatedGIF category to support gif in imageView.
If you want to play gifs from the url, you can consider the webView instead of imageView.
There is no built-in support for animated GIFs in iOS. I found a third-party framework that lets you display animated GIFs. I'm not at my Mac right now so I don't have the info, but it looks like there are quite a few libraries that offer animated GIF support on Github.
As Mr. T. says you can also use an array of images in UIImageView to get the same effect. (And there are tools that let you decompose an animated GIF into its frames.)
Sorry, I've asked a similar question but I'm already suffering 3 days dealing with a simple photo gallery in my app. I just need a gallery with array of 1024x768 images, a gallery that will fit pictures properly into the screen.
I've tried
ATPagingView - worked fine but an 1024x768 image couldn't be resized properly for both orientations.
MWPhotobrowser - didn't managed to connect because i'm using ARC, even if I disabled arc for added files, there was a compile error I coudn't get rid of.
Custom UIScrollView with pages, with a scrollView for each page and imageview inside it, but it didn't help.
Please, help me somehow, did somebody make galleries like that?
Give Nimbus a try. It is an open source framework that is run by jverkoey, ex Three20 guy. It is not ARC'd yet, but you can turn ARC off for compilation and that works just fine, plus they are moving to ARC soon, already have a git branch of it. It has a photoviewer class but I've not used it yet, but I will need to, that's only one of the reasons I'm using it. Pretty happy with it so far!
I already found KTPhotoBrowser classes. They are nice and well-documented. I implemented the very simple photo browsing gallery very fast. Images are now resized properly, everything is okay. if you want a gallery, try this, for sure!