c# - JpegBitmapDecoder decode jpeg failed? -
i'm using following code decode jpge image
unmanagedmemorystream^ mstream = gcnew unmanagedmemorystream(_jpegdatabuff, _bufflength); jpegbitmapdecoder^ decoder = gcnew jpegbitmapdecoder(mstream, bitmapcreateoptions::preservepixelformat, bitmapcacheoption::onload); bitmapsource^ bitmapsource = decoder->frames[0];
i use bitmapsource
display on control of wpf, the result below
i have searched on internet, did not solve yet!
someone can me?
many thanks,
t&t
from looks of either jpeg source incomplete or invalid. exceptions jpegbitmapdecoder throws argumentnullexception
(stream null
) , fileformatexception
. file format detected analyzing file header. jif/jfif file structure holds image description information in relatively small header followed "raw" data.
i guess decoder built resilient ignore invalid (rendered last before gray) and/or missing (rendered gray) blocks. think way detect either analyze final image (maybe checking last 8x8px block doesn't have same color?) or source (maybe counting data blocks?).
Comments
Post a Comment