开发者

convert graphic to Bitmap [closed]

Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_运维技巧

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 4 years ago.

Improve this question

I am creating a Graphics object to draw on the original image and I want save the modified image as a new image.The Image on the form as well as the drawing


 //load bitmap from file
 Image bmp = Image.FromFile();

Graphics g = Graphics.FromImage(bmp);

//do drawing here with g.

bmp.Save();

g.Dispose()


    Bitmap newBitmap = new Bitmap(originalBitmap);
    using (Graphics myGraphics = Graphics.FromImage(newBitmap))
    {
        // draw here on myGraphics
    }
    // newBitmap - modified image

Alternatively with Load & Save:

    Bitmap myBitmap = new Bitmap("fileName.bmp");
    using (Graphics myGraphics = Graphics.FromImage(myBitmap))
    {
        // draw here on myGraphics
    }
    myBitmap.Save("newFileName.bmp");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜