473,698 Members | 2,370 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bitmap or Image

Whats is there any reason to use a Bitmap(Image) over an Image(Bitmap)? I'm
making a container to hold bitmaps sorta like the ImageList class(that
doesn't fix the sizes) but I'm not sure if I should use Images or Bitmaps?
I don't know of the real distinction between them excep that the Bitmap
class allows you lower level access to the image data and stuff(but does it
come at a price)?

Thanks,
Jon
Oct 23 '06 #1
4 1643
Hi Jon,

Image is an abstract class, and the base class for MetaFile and Bitmap.

I'd use Bitmap as everything the Image can do, Bitmap can do as well.
Since Bitmap inherits from Image, all places expecting an Image object can
take a Bitmap object.
On Mon, 23 Oct 2006 05:28:20 +0200, Jon Slaughter
<Jo***********@ Hotmail.comwrot e:
Whats is there any reason to use a Bitmap(Image) over an Image(Bitmap)?
I'm
making a container to hold bitmaps sorta like the ImageList class(that
doesn't fix the sizes) but I'm not sure if I should use Images or
Bitmaps?
I don't know of the real distinction between them excep that the Bitmap
class allows you lower level access to the image data and stuff(but does
it
come at a price)?

Thanks,
Jon



--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 23 '06 #2
"Jon Slaughter" <Jo***********@ Hotmail.comwrot e in message
news:oF******** **********@news svr13.news.prod igy.com...
Whats is there any reason to use a Bitmap(Image) over an Image(Bitmap)?
I'm making a container to hold bitmaps sorta like the ImageList class(that
doesn't fix the sizes) but I'm not sure if I should use Images or Bitmaps?
I don't know of the real distinction between them excep that the Bitmap
class allows you lower level access to the image data and stuff(but does
it come at a price)?
Image is the base class and is inherited by Bitmap and Metafile. If you wish
to support both Bitmaps and Metafiles then use Image. If you only want to
use Bitmaps then use Bitmap, there won't be any overhead as the object will
be a bitmap anyway.

Michael
Oct 23 '06 #3
Well, Image is the abstract base class of Bitmap. Having a list of
Images does mean that theoretically you can handle /any/ Image
implementation, but there aren't many... in the core MS libraries this
is just Bitmap and Metafile (IIRC), although in reality Bitmap is by
far the more common. If you only need to handle Bitmap, then a list of
Bitmaps should be fine, and save some casting. If you don't need the
extra Bitmp properties, then use Image.
but does it come at a price
No; since Image is abstract, you cannot have just an Image; typically
you have a Bitmap, but treat it like the base Image; but it is still a
Bitmap ;-p. In terms of storage in your class, it is still just a
pointer to the heap, so identical.

Marc

Oct 23 '06 #4
Ok, Thanks guys. I would like to use both an image and metafile since it
offers a more robust solution. I play around with it and see what happens.
Basically I'm trying to setup a button that displays a user defined set of
images depending on the state. Obviously bitmaps are nice but not always
needed and vector graphics are simple and tend to offer an easier
implementation( such as what the OS already uses). It seems much easier just
to create teh metafile with some external program and load it instead of
using a bunch of graphics commands to draw it. (but I suppose I can just
keep a list of images that represent the state and draw them using DrawImage
and not worry to much about the underlying type)
Thanks,
Jon
Oct 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3600
by: CroDude | last post by:
Hi all! I have problems when writting bitmap to a byte array and after reading it back form byte to Bitmap object. What I do is this: First I throw Bitmap to a memory-stream and then I write it into byte from a stream. Exception (System.ArgumentException: Invalid parameter used) occurs when reading from byte over a memory-stream back to the Bitmap object. Please help, I'm really stuck here! Here's the code I use (Sorry for a long...
7
6099
by: chuck | last post by:
I load a bitmap using GDI+ now, I want to collect all the pixel values, (in RGB but without the A component) onto a color array, say... dim btmp1(,) as color is there a method that can help me collect the pixel values as quickly as possible (like one row at a time)? what about setting (or changing) the pixel values back onto the bitmap?
8
3315
by: Nathan Sokalski | last post by:
I am trying to write code to rotate a graphic that I have. Here is the code I am currently using: Dim frogbitmap As New Bitmap(Drawing.Image.FromFile(Server.MapPath("images/frog.gif"))) Dim froggraphic As Graphics = Graphics.FromImage(frogbitmap) froggraphic.RotateTransform(90) frogbitmap.Save(Server.MapPath("images/frog2.gif"), Imaging.ImageFormat.Gif)
7
8239
by: Fir5tSight | last post by:
Hi All, I used the following code in C#: using System.Drawing; //blah blah blah Bitmap bmp = new Bitmap();
1
7825
by: Smokey Grindel | last post by:
I have a bitmap object I want to return as a JPEG image with a compression set at 90% and progressive passes enabled, how can I do this in .NET 2.0? Progressive passes are not necessary but the compression ratio is.. thanks!
14
11900
by: eliss.carmine | last post by:
I'm using TCP/IP to send a Bitmap object over Sockets. This is my first time using C# at all so I don't know if this is the "right" way to do it. I've already found out several times the way I was doing something was really inefficient and could reduce 10 lines of code with 2, etc. For reading, I am using a TcpClient and I call NetworkStream ns = client.GetStream(); to get a stream stream.Read(buffer, 0, buffer.Length);
0
2877
by: benfly08 | last post by:
Hi, guys. I have a program to draw bar/pie chart based on the data i hard coded in it. However, my image comes with "BLACK" background color. I don't know how to fix this. The code snippet is below: chartGenerator.vb class: Imports System.Drawing.Imaging Public Class chartGenerator Private myImage As Bitmap
2
2798
by: Tina | last post by:
I have a System.Drawing.Bitmap myImage; I also have a webcontrols.Image on my web page. I want to put the bitmap into the image but the image can only get it's bitmap from ImageURL which can be a fileName or a webpage that writes. But I don't want to have to write my bitmap to a file, I just want to put it into the image. Can this be done? It seams that an image control should be designed to that it could accept a bitmap (duh) but I...
5
9092
by: stef | last post by:
hello I can find all kind of procedures to convert an array to a bitmap (wxPython, PIL), but I can't find the reverse, either - convert a bitmap to an array or - read a bitmap file to an array
2
2934
by: Peter Oliphant | last post by:
The Image class allows loading a bitmap from a graphic file. So far I've gotten it to work with JPG and BMP files. What other graphic file formats are supported in this way? Is this fixed based on the .NET Framework used (e.g., the Image class defines which formats can be used), or can different file formats be added after-the-fact (end-user capability in contrast to developer implementation)? Also, is it possible to save an image in...
0
8674
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.