Jpeg Decoding

Dec 3, 2010 at 2:32 AM

Hi all,

I'm new to Silverlight. I want to convert a string which is a source of the image into a Jpeg Image.. Is it possible to do it through JpegDecoding? If possible pls post some sample code..

 

Thanks in Advance

Coordinator
Dec 3, 2010 at 8:05 AM

Hi,

lets say the string is encoded using Unicode:

public void LoadImage()
{
  byte[] buffer = Encoding.Unicode.GetBytes(myString);

  Stream stream = new MemoryStream(buffer);

  ExtendedImage image = new ExtendedImage();
  image.LoadingCompleted += ExtendedImage_LoadingCompleted;
  image.SetSource(stream);
}

private void ExtendedImage_LoadingCompleted(object sender, EventArgs e)
{
   ExtendedImage image = (ExtendedImage)sender;
  
   // Image is now loaded.
}




Dec 3, 2010 at 8:52 AM

Thanks For the Reply..

Is it possible to assign it to the System.Windows.Controls.Image?

 

How to assign it?

I'm getting error "Cannot implicitly convert type 'ImageTools.ExtendedImage' to 'System.Windows.Media.ImageSource' "

 

Help Me:)

 

Thanks in Advance

Mar 11, 2014 at 3:54 AM
Jpeg decoder, especially Jpeg2000 decoder is based on the technique of Wavelets,and it is able to present images at different resolution and sizes. That is to say you can display full size, full resolution or half size, one-ninth of resolution from the same image file. If you want to convert a string which is a source of the image into a Jpeg Image, why not try an image to byte array tool?
Apr 8, 2014 at 4:24 AM
Jpeg Decoding
The string is successfully encoded using Unicode. Not sure how to asign it.
May 22, 2014 at 2:51 AM
Here's how you can encode as well as decode JPEG.