Have MediaElement in my application used to preview media file such as music, video, image..
MediaElement only allow set source is a URi(contain file path).
I have image storaged by Byte array and now I want preview it on MediaElement.
how to I convert from byte array to uri to preview mediafile ?
If have any other solution to preview mediafie, Please list it. Thank.!
if it is path...then you can use
System.Text.Encoding.UTF8.GetString(byteArray[])
and then assign that path to media element to preview image...
If it is image, you have to convert back that image from byte and then assign it ti Image element...to preview. Check this link:
http://www.codeproject.com/KB/recipes/ImageConverter.aspx
You can do it through a MemoryStream. See example here.
Related
I stumbled upon a problem during my work with codename one and the parse4cn1 plugin.
I try to upload an image which I took with the capture module of codename one. According to the documentation of parse4cn1 I have to convert the image into “Bytes” with the “getBytes” function. But according to the Codename one documentation getBytes only works with Strings and not with images.
Do you know how to “convert” the image appropriately?
I have been using this documentation, the section "uploading files":
https://github.com/sidiabale/parse4cn1/wiki/Usage-Examples#uploading-files
getBytes() is a method of EncodedImage not image. An encoded image can map to a PNG or JPEG and is a subclass of Image. You can use EncodedImage.create*() methods to load an EncodedImage directly or convert an existing image to an EncodedImage:
EncodedImage e = EncodedImage.createFromImage(img, false);
The second argument indicates if this should become a PNG or JPEG. If the image includes transparent/translucent pixels use PNG. If the image is a photo use JPEG.
We have a system in which we have big plan images loading in multiscale deepzoom images like an image gallery.Images are usually of very high resolutions.
Users have the ability to draw shapes ect on selected deepzoom image.We are using a canves on deepzoom image and save all overlay shapes drwan along with their logical poistion in db.thus the drawn shapes auto sets their position as user pans in or pans out.
We need an automated solution so we can take the printout of all the plan images along with all overlay work done on each deepzoom image.
Currently we are doing this one by one i.e we use Grid,Multistage,Canvas.We load image in Multiscale image,then draw Canves then we use following code to same them in jpeg from Grid(ContentGrid)
SaveFileDialog saveDlg = new SaveFileDialog();
saveDlg.Filter = "JPG Files (*.jpg|*.jpg|*.jpeg|*.jpeg)";
saveDlg.DefaultExt = ".jpg";
if ((bool)saveDlg.ShowDialog())
{
using (Stream fs = saveDlg.OpenFile())
{
SaveToFile(new WriteableBitmap(ContentGrid, null), fs);
}
}
But this solution does not work properly.This throws memory issues when deepzoom image is big one.
We want something like this.For all plans images in gallery we need to loop and programatically convert to jpeg along with canves etc and then save to Amazon s3 by program.An automation will pick all the jpegs and make a single pdf for all those.
or an automated solution.
Please suggest.
Need it to work in WPF
Basically I am showing a list of all vide files in a list control and I want a image frame or thumbnail if you will
was wondering how explorer does it ?
it probably does what you expect: it reads some of the file, uses the appropriate codec to decode some video, and then creates an image from one or more frames.
I capture an image using the photo or camera task and I want to resize the image to say example 480x240 from the captured size of around 2592x1944.
how do I do this ?
thanks
You can pass the JPEG stream you get from the Completed event to the PictureDecoder.DecodeJpeg method. The second and the third parameters define the size. You will get a WriteableBitmap that can be manipulated further and saved back to the MediaLibrary. See this blog post for some example.
I am using ImageTool's PNG encoder to create an image.
I have a Grid that contains multiple TextBlocks, each TextBlock contains dynamic text.
When I create a WriteableBitmap from the grid containing the TextBlocks, I then use ImageTool's encoder to convert the WriteableBitmap to a PNG image.
All works well, however, when I view the PNG image (am saving the file to the hard drive for testing purposes) - the text looks slightly blurred. Is this an issue with the encoder or the WriteableBitmap class? And - has anyone experienced this before and are there workarounds?
Thanks.
I'm a part of ImageTool project but I'm playing as a tester since I'm using this library in one of my project... If you can create a sample then you can probably show us so that we can test in our machine.
You can also try with Joe Stegman's encoder or fJCore JPEG encoder.