When to use BMP vs IMAGE?

  • Thread starter Thread starter Ray Martin
  • Start date Start date
R

Ray Martin

What the difference and advantages of using:

dim MyImage as Image = Image.Fromfile("sample.jpg")
vs
dim MyImage as new bitmap("sample.jpg")

Both seem to work fine.
 
To clarify, I find it's easier to use Bitmap in code because it has more
functionality than Image. However, if you're writing a library it's a good
idea to try to take Image instead of Bitmap as a parameter wherever possible
because you'll be able to support any other object derived from Image as
well.
 
* "Ray Martin said:
What the difference and advantages of using:

dim MyImage as Image = Image.Fromfile("sample.jpg")
vs
dim MyImage as new bitmap("sample.jpg")

'Bitmap' inherits from 'Image'. 'Image' is more general and can hold
'Bitmap' objects, 'Metafile' objects, ...
 
Back
Top