Create GIF from images in a Windows Phone app - c#

My question is easy: Is it possible to create an animated GIF file from a Windows Phone app (7.8 or 8, or both) using C# ?
I searched on the internet for this and I found these tutorials:
http://bloggingabout.net/blogs/rick/archive/2005/05/10/3830.aspx
http://www.codeproject.com/Articles/11505/NGif-Animated-GIF-Encoder-for-NET
They are really cool and work perfectly for desktop app, but I can't make them work on a Windows Phone app, many classes are unavailable and I can't find a workaround. Is it really impossible to create a GIF file from images on a Windows Phone ? Is it due to the devices limitations ?
Thanks

Ok i don't know how far Ill be able to help. But if you are facing limitations in displaying a gif Image then you can use a nuget package named image tools
Blog for Image tools
And on the other hand if you want to display a number of images then I can suggest a work around. But it will be app specific.
use storyboards or timers to continiously animate an Image object or a Grid back ground.
Creating an image I guess is not possible due to device limitation
still if you have a sprite image
then you can use
<ImageBrush.Transform>
<TranslateTransform X="-380" Y="200" x:Name="tfDieImage"></TranslateTransform>
</ImageBrush.Transform>
Transforms to animate the image at regular intervals by changing the X and Y :)

In fact there is a very interesting way to create animated GIF. It is from VB6 days.
Just create every frame as separate GIF file with same color palette (this is the tricky part). strip GIF header from files except first file and then concatenate them with following magic 0x0021F9.
Animated GIF format is actually an extension to the GIF format so, application does not understand animated GIF can still be able to display first frame. As far as I remember that each frame can have its own color table, but I do not remember how.
The real trick is to create series of images sharing same color palette, which I haven't done it before. I just used this to load animated GIFs.

Why don't you try to do it by yourself? GIF format now is free, so if you need only to create GIF files, you can just implement specification or only part of it.
http://www.w3.org/Graphics/GIF/spec-gif89a.txt

Ok.
I will suggest you one post that shows that how to display a GIF formatted pictures or Animated pictures in windows phone.
Please Refer this link.
Show OR Create the GIF kind Images in windows phone.
This shows that there is like a GIF image but actually there is not a GIF but its a multiple jpeg files Array.
I hope you get the Solution.
Good Luck.

Related

Is it possible to crop videos and save them in Unity?

I'll explain my situation : I have a UI image, of fixed size, and if clicked it shows a video (like Live Photos). The video could be of every possible resolution and with an AspectRatioFitter and a mask I make the video fill the entire image. In this way only a portion of the video (that match the image resolution) is visible, the rest of it is "cropped", hides. I was wondering if it's possible to actually save to the disk only the visible section of the video, cropping the parts not visible. In the end the goal would be to have the image and the video of the same resolution. Is it possible to do this in Unity?
You can use C# to get video files on your system and crop them at your preferred times and then save them to your preferred folder. I have linked a google search for you that should help you find what you're looking for, try using the videos if you need something visual. Crop a video using C#

Best way to render images as a video clip in a mobile device

I have tried to approach this problem several ways.
I have a web application that will load a sprite (which is a large jpeg that 'holds' 100 frames. Using the offset of div properties I am able to 'move' the image along so it looks like a movie clip.
This works well.
I need to produce the same on mobile devices.
I have to support Windows Mobile 6.5.
I was using jQuery/ajax to move the sprite image along to stop any flickering of the image within the browser.
Windows mobile 6.5 does not support this.
So, i decided to do a native app using C# Framework 2.0.
I thought about converting the sprite to a mp4 file and playing within a web browser control. but IE on the device will not support html5.
I have been told there is a CAB file from adobe so that I can play flash videos on the IE. But, apart from using ffmpeg to convert these images to a flv there is not much control as to adding menu like pause,stop,play etc when playing the flv file. I have not started any of this by the way i assume that would be the case.
So.. I thought if I download the sprite to the device i could use the graphics object of a picture box and render the rectangle of interest from large sprite to picture box.
I could not download the Sprite and save it to an image though. I get 'out of memory exception'.
I used the OpenNetCF.Drawing as it is supposed to support large files. I still get the error message. I have reduced the size of the image and it will work on about 20 frames.
I would then have to 'stack' these images containing 20 frames and load them up when necessary.
I am beginning to wonder now whether i am doing the right thing?
Is there a different way of trying to achieve what i am trying to achieve that is quicker and more efficient as I have run out of ideas.
If I am OK doing it this way then what is the best way to render images in a picturebox like a video. Memory efficiency says load the image from the file on the device when needed and dispose of it but that would cause 'flickering'. What IS the best way to handle multitude of images on a device?
i have plenty of code I can upload but I was worried the question would look 'messy' as I have tried so many things. I will of course edit/upload the code as required.
Thanks.

Storing animated GIFs on Windows Phone

My own tests have shown that GIF images saved to the Windows Phone 8 MediaLibrary always get converted to JPG. Is there any way around that other than managing my own library - which I'm already doing?
As far as i know you can not directly save .gif file into Media Library, you can try to save in Camera Roll using Image Tool Library.
Hope it helps
Just to clear up some misconceptions here, WP8 does in fact save gifs from IE, MMS, emails etc as full gif files, NOT jpgs. It is just that when displayed in the Picture hub, only the first frame is displayed. WP7, however, did convert gif to jpg on save.
You can prove this yourself by downloading the GIF Viewer app which will allow you to browse and play gifs in your media library.

How to show a gif image in WinRT?

I am trying to show NON ANIMATED gif images in my WinRT app. My current solution is to use a server side converter to convert the images to png, and then load them into an Image control. I have limited bandwidth and would prefer to do it in-app. I used .Net Image Tools to do this on Windows Phone, but it does not appear to be available for Windows RT. I cannot show the images in a WebView because I need to show another element over the image. I know this is a duplicate of this, but that was closed by users who thought it was a duplicate of a question asking about showing animated gifs. My question is how to show NON ANIMATED gifs, and I can't seem to delete the old question.
You can use the gif directly in XAML within the <Image> element. There is no need to convert it. Just set the Source attribute to the image.

Update Windows 8 Live Tile With Video

I know it is possible to update a live tile in Windows 8 with image and text. But, I wanted to update the tile with a video.
Is it possible? If a video cannot be sent directly, can we break the video into many images and then update?
You cannot add video to the live tiles neither the gif images (you can add gif's but they won't work as intended). Adding video is not allowed since it'll consume lot's of system recourses in the background task. The purpose of live tile's are to show information not content itself so that user can just glance on it and take action if needed.

Categories

Resources