المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Showing non 96dpi jpegs in PictureBox



C# Programming
11-13-2009, 08:30 AM
I display some jpeg images loaded from Stream object in dynamicly created PictureBox component.


void function(Strean jpegStream)
{
Bitmap img = new Bitmap(jpegStream);
//attach the img to PictureBox control, created dynalically in advance
}


While 96dpi images are displayed correctly, some of the non 96dpi jpegs, e.g. 72dpi, 480dpi which come from photoshop or digital cameras get corrupted after I attach them to Image property of the PictureBox component and they are displayed.

As though half of the jpeg or more were not decompressed, leaving bottom half of the image grayish.

However if I delete and create again PictureBox component, and attach the same Bitmap object img again, already created from jpeg stream, they are correctly displayed???


????????