0

I am trying to convert byte array, which contains image description to bitmapimage

but I got an error: "Additional information: No imaging component suitable to complete this operation was found."

My code is:

public BitmapImage ImageData
    {
        get
        {
            BitmapImage btm;
            using (MemoryStream ms = new MemoryStream(mSpaceObject.ImageData))
            {
                btm = new BitmapImage();
                btm.BeginInit();
                btm.StreamSource = ms;
                btm.CacheOption = BitmapCacheOption.OnLoad;
                btm.EndInit();
                btm.Freeze();
            }
            return btm;
        }
    } 
Yuriy Mayorov
  • 961
  • 4
  • 15
  • 32
  • Maybe [this](http://stackoverflow.com/questions/14337071/convert-array-of-bytes-to-bitmapimage) question could prove useful – Andrea Jul 20 '13 at 21:53
  • Add an error handler like this sample to see what's wrong with the image: [example](http://stackoverflow.com/questions/7292764/no-imaging-component-suitable-to-complete-this-operation-was-found-in-c-sharp) – Ted Jul 20 '13 at 22:43
  • 1
    The words "image description" do not mean much. You need the bytes of an image, exactly the same format they have when stored in a file. The error message means that it doesn't recognize the format. So it probably just isn't valid data. Save it to a file instead and use a hex viewer. Post a screenshot of it. – Hans Passant Jul 20 '13 at 23:06

0 Answers0