i have a trouble converting byte array to an image by common methods for example:
using (var ms = new MemoryStream(byteArrayIn))
{
return Image.FromStream(ms); ->exception
}
and
System.Drawing.ImageConverter converter = new System.Drawing.ImageConverter();
Image img = (Image)converter.ConvertFrom(ImgInBytes); -> exception
The exception is Parameter is not valid
moreover, i used a 4 byte array length which was initiated by zero value.
it was supposed to show a black image but it didn't
byteArrayInvariable. If you just want to create an empty black image, what stops you from using a new Bitmap? Moreover, from where does your information come that it is supposed to be a black image? How would you decide on width & height of a picture?0 0 0 0is not a valid image format. Most images consist of an identification token (png always starts 137 80 78 71 13 10 26 10, for example) - then format-specific encoded metadata - dimensions, color depth, possibly a color palette, maybe date/location/tool metadata; then finally some pixel data, which could use a range of encodings... and that's assuming it is pixed-based (vs vector-based)