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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.