开发者

How can I load a Image from a file, then an image to a bitmap?

开发者 https://www.devze.com 2022-12-15 16:11 出处:网络
I have a file location on my file system. I need to first load the file into开发者_运维问答 a System.Drawing.Image, then I need to load the Image into a bitmap.try the Image.FromFile and Bitmap.FromF

I have a file location on my file system.

I need to first load the file into开发者_运维问答 a System.Drawing.Image, then I need to load the Image into a bitmap.


try the Image.FromFile and Bitmap.FromFile methods. if you specifically need to convert an Image instance into a Bitmap instance, I think you can pass in an Image object in the Bitmap constructor.


Skip the "load into an Image" step, it's a one-liner:

Bitmap bmp = new Bitmap(path);

Bitmap is derived from Image, you can use it where-ever an Image object is required.

0

精彩评论

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