System.Drawing.Bitmap final_image = null
System.Drawing.Graphics graphic = null
original_image = System.Drawing.Image.FromStream(jpeg_image_upload.InputStream)
final_image = new System.Drawing.Bitmap(target_width, target_height)
graphic = System.Drawing.Graphics.FromImage(final_image)
graphic.FillRectangle(new System.Drawing.SolidBrush(System.Drawing.Color.Black), new System.Drawing.Rectangle(0, 0, target_width, target_height))
int paste_x = (target_width - new_width) / 2
int paste_y = (target_height - new_height) / 2
graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic/* new way */
graphic.DrawImage(original_image, paste_x, paste_y, new_width, new_height)
final_image.Save(strPath + strNewFileName, System.Drawing.Imaging.ImageFormat.Bmp)
///////////清稿/////陆碧//////////////////////早正举/////
思路就是读取到文件流中,然后按照mageFormat.Bmp重新保存
一般而言raw文件也分彩色和黑白的。彩色的弊蠢需要对每一个像桥卜者素进行差值运算(bayer算法,这个抱歉我不能开源)。还原成24或者32位彩色再敏薯存成bmp,黑白的相对简单,直接bitmap头即可。 如果你要黑白的我可以给你代码~欢迎分享,转载请注明来源:内存溢出
评论列表(0条)