Animated Gif issue on iPhone, iPad - ios

I am having an issue where my animated .gif (created in PhotoShop) transitions are not rolling out correctly on an iPad and iPhone.
Instead of fading to the next frame, the next frame is appearing a yellow object without having the smooth fade to it.
It is animating just not a smooth animation.

You may wish to use imagemagick to see if it can solve the problem for you. I've just had to deal with a GIF file which has been working without any issue on desktop browsers, but on ios it has been showing strange blue artifacts.
Just run the GIF through the convert function and then try the output file.
convert original_file.gif output_file.gif
Imagemagick will probably decode the original file before creating a fresh new output, but without including whatever encoding style caused problems in the original.

Related

Lottie animation has missing parts in iOS but works perfectly in html and Android

I've made an animation of a ship with a moving flag and waves in After Effects and exported it to JSON using Bodymovin. I used the wave warp effect for the flag and the waves but since Lottie doesn't support that effect I fixed it using auto-trace and now the animation works as expected when in HTML. Problem is, I need it to work on iOS but the red part of the flag and the little waves are missing from the animation when run on iOS. I even tried running it in an Android app and everything works there too. Has anyone ever encountered something like this before?
I've attached the picture that I want to animate, the file structure and also, the JSON file.
In my case, my file was just simply too big due to the auto-tracing.

gif not animating correctly in Microsoft edge

I am working with a loading gif on a website and it works correctly on all browsers except Microsoft edge. With edge, the gif runs all the way through the loading circle, but at what I assume is the last frame*, a sliver of the gif freezes and stays there as the gif continues to play through again. Once it happens one time, it will continue to happen until the user leaves the page. I can't put up a link to show the actual gif I am struggling with,
however I just created something quickly in paint.net and threw it into an online animation tool to show what it is doing.
https://giphy.com/gifs/QsUAu5ud4ibIdq97sm
So with this quick gif I just created, once that red mark shows up, it will show up every time after the initial load of the gif.
*I am just assuming it is the last frame but I can not access a copy of the gif before it was compiled into gif format so I don't know how much of the loading animation is in each frame
What I am asking is if anyone knows how to fix this issue when using edge. I am limited because I cannot change the gif itself in anyway or change
the frame rate of the gif. Any ideas are welcome because I am all out of ideas and have spent hours scrolling through
pages online looking for a solution and haven't come across anything close to what is happening here.
Also this is how the gif is being created on the page with the html. Not sure if this is helpful in this case or not:
<div style="text-align:center">
<img src="~/Content/images/GIF-loading.gif" id="loadingGif" />
</div>
I have tried to create a sample using your code and download a loading image from here, it seems that it works well on Microsoft Edge 44 and Edge 42, the result like this. So, I think you could try to download a new loading image and retest it on your side.

IOS Gif Showing the Last Frame of the Previous Frame

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.

Use a gif as a placeholder while downloading an image

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.)

Load retina (high quality) images programmatically (on buttons)

I have a problem that I just haven't been able to figure out. I have an app done that will take a picture from the front and one from the back camera, then merge them together.
The name of the app is GroupCam
However I have an issue in where my UIButtons will not be loaded as retina images from the start. If i set them as #2x on the interface builder they do appear in high quality but once I reload them programmatically the low versions will appear instead.
This is due to the fact that, after a picture is taken and the screen changes the button images change, but when the user presses the back button the camera icons will look horrible (because the low quality versions are being loaded).
Please check the following pictures:
First Screen: Only the upper right button appears distorted because I am checking the value of the camera flash and "loading" the corresponding image programatically.
Second Screen: The user has moved to another screen and came back to the first one, all buttons were reloaded and they now all look distorted.
Why is this happening?
Edit:
This is how I load the images.
[self.flashButton setImage:[UIImage imageNamed:#"flashOff"]
forState:UIControlStateNormal];
I read somewhere on the internet that doing this will automatically load the most suitable version of the image.
I also tried this but the result is the same:
[self.takeButton setImage:[UIImage imageNamed:#"takePhoto.png"] forState:UIControlStateNormal];
First off, its probably worth verifying that the low-res versions are actually being displayed. I had jumped to a similar assumption recently, swapped out the low-res version of the image with something different, and confirmed that the hi-res version was actually still being displayed, but was being distorted.
My actual problem, I had set
<uibutton_superview>.layer.shouldRasterize = YES;
If any of the buttons ancestors have this set, it could likely be your problem.
If your app is taking a picture from the front camera and one from the back camera and merging them together, then the device requires a front facing camera. All iOS devices which have front facing cameras also have retina display's (so long as your not developing for the iPad 2, but that's a different story) so you shouldn't really have to have normal images at all, so all your images should be retina images. If there are no normal images, then this issue shouldn't happen at all. Make a backup copy, and try deleting all the normal images, and then try. Because your using the UIImage imageNamed:#"ImageName", like you said, should automatically select the image! Good Luck!
The case of the filenames of the images does not matter on the simulator, but does on the device.
Use all consistent case. Image.png and image#2x.png are recognized and will work together in simulator but not on device. use image.png and image#2x.png. Or you can also use .jpg as long as case is matching.

Resources