How to show a gif image in WinRT? - c#

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.

Related

How to write text on image in windows store app development? C#,wpf

I have search so much on this topic and I couldn't find a way to draw a text on image or even a create an image and then draw a text in windows store app.
Is there way to load image from ms-appx:///Assets/image.png and write a text on the center of the image that passes somehow and save it into ms-appdata:///roaming/image11.png?
Use RenderTargetBitmap - this article has a pretty good explanation for Windows Store apps: http://social.technet.microsoft.com/wiki/contents/articles/20648.using-the-rendertargetbitmap-in-windows-store-apps-with-xaml-and-c.aspx.
If you meant WPF, it's similar: http://wpftutorial.net/BitmapFromVisual.html (just create a image control with textbox for the Visual)

Create GIF from images in a Windows Phone app

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.

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.

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.

WPF integrating with web cam

How do you integrate a PictureBox to display a video through WPF?
You probably don't want to use PictureBox to display images in WPF because it's a Windows Forms control and therefore suffers from interop limitations.
To display an image in WPF, use the Image element. Set its Source to be, typically, a BitmapImage whose UriSource is the URI of the bitmap file (which might be on the file system). (You can use another ImageSource type if that's an easier way to interface with the webcam.)
To display video, use the MediaElement element. To display a video file, set MediaElement's Source property to the URI of the video (which again might be on the file system). If you need to pull images from the webcam in order to form the video, you need to use the MediaElement in "clock mode," which is described in the MediaElement class topic in MSDN. See also "Multimedia Overview" in the WPF SDK (http://msdn.microsoft.com/en-us/library/aa970915.aspx).
Also try WPF MediaKit. The WPF MediaKit has a VideoCaptureElement control for WebCam support!

Categories

Resources