[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Displaying GrayScale Images

RICK

1/8/2005 2:01:00 PM

I am converting an Win32 medical image processing application to .Net. I am
new the UI side of .Net applications and I am trying to display a grayscale
images at a reasonable frame rate (5-10 frames per second). The application
captures 1024x768 12-bit grayscale pixels, which I am storing in managed
array. My initial thought, was to create a bitmap and copy the captured data
to the BitmapData section of an image. I initially tried to create the Bitmap
using the PixelFormat.Format16bppGrayScale. After having a bit of trouble, I
read in a few other news group postings that the Format16bppGrayScale option
is not really supported. Is that true? I also noticed that images can have an
attributes and the ImageFlags attribute has a value to specify ColorSpaceGray
and also has a flag called Caching, which both seem like attributes that I
would want to use. I have not found much documentation or examples on how
they can be used. Can anyone point me in the correct direction?

From the Win32 app, I saved a bitmap of an image then constructed a .Net
image by reading that file. I noticed that imaged was created with the
PixelFormat.Format8bppIndexed and was using a grayscale color palette. It
that the better method of setting up and display grayscale images?

Am I on the right track, or should I be taking a different approach?

Any thoughts will be appreciated.
2 Answers

Bob Powell

1/9/2005 2:03:00 PM

0

All the 16 bit image formats in GDI+ are broken. You'll not use them
successfully.

Your 8bit indexed image idea seems like the best bet. I would recommend that
you read the GDI+ FAQ which has information on how to change the colour
palette of a GIF image which will enable you to crete a custom grayscale
palette and the article on LockBits which will show you how to get the best
access speed for pixels in the 8 bit array. You'll need this if you're going
to get the best throughput of 5-10 frames per second. You can store
grayscale images in 24bpp or 32bpp image formats but the raster is
correspondingly larger and hence more memory to shuffle around when you're
doing a high frame rate.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Rick" <Rick@discussions.microsoft.com> wrote in message
news:704DC494-2551-45B5-A76E-032225C167E1@microsoft.com...
>I am converting an Win32 medical image processing application to .Net. I
>am
> new the UI side of .Net applications and I am trying to display a
> grayscale
> images at a reasonable frame rate (5-10 frames per second). The
> application
> captures 1024x768 12-bit grayscale pixels, which I am storing in managed
> array. My initial thought, was to create a bitmap and copy the captured
> data
> to the BitmapData section of an image. I initially tried to create the
> Bitmap
> using the PixelFormat.Format16bppGrayScale. After having a bit of trouble,
> I
> read in a few other news group postings that the Format16bppGrayScale
> option
> is not really supported. Is that true? I also noticed that images can have
> an
> attributes and the ImageFlags attribute has a value to specify
> ColorSpaceGray
> and also has a flag called Caching, which both seem like attributes that I
> would want to use. I have not found much documentation or examples on how
> they can be used. Can anyone point me in the correct direction?
>
> From the Win32 app, I saved a bitmap of an image then constructed a .Net
> image by reading that file. I noticed that imaged was created with the
> PixelFormat.Format8bppIndexed and was using a grayscale color palette. It
> that the better method of setting up and display grayscale images?
>
> Am I on the right track, or should I be taking a different approach?
>
> Any thoughts will be appreciated.


RICK

1/9/2005 8:05:00 PM

0

Thank you very much for the info. Your FAQ was very helpful. I appreciate
your insight and feel much better now that I know that I am heading in the
correct direction.

Thanks again!.

Rick

"Bob Powell [MVP]" wrote:

> All the 16 bit image formats in GDI+ are broken. You'll not use them
> successfully.
>
> Your 8bit indexed image idea seems like the best bet. I would recommend that
> you read the GDI+ FAQ which has information on how to change the colour
> palette of a GIF image which will enable you to crete a custom grayscale
> palette and the article on LockBits which will show you how to get the best
> access speed for pixels in the 8 bit array. You'll need this if you're going
> to get the best throughput of 5-10 frames per second. You can store
> grayscale images in 24bpp or 32bpp image formats but the raster is
> correspondingly larger and hence more memory to shuffle around when you're
> doing a high frame rate.
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tips...
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/f...
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Rick" <Rick@discussions.microsoft.com> wrote in message
> news:704DC494-2551-45B5-A76E-032225C167E1@microsoft.com...
> >I am converting an Win32 medical image processing application to .Net. I
> >am
> > new the UI side of .Net applications and I am trying to display a
> > grayscale
> > images at a reasonable frame rate (5-10 frames per second). The
> > application
> > captures 1024x768 12-bit grayscale pixels, which I am storing in managed
> > array. My initial thought, was to create a bitmap and copy the captured
> > data
> > to the BitmapData section of an image. I initially tried to create the
> > Bitmap
> > using the PixelFormat.Format16bppGrayScale. After having a bit of trouble,
> > I
> > read in a few other news group postings that the Format16bppGrayScale
> > option
> > is not really supported. Is that true? I also noticed that images can have
> > an
> > attributes and the ImageFlags attribute has a value to specify
> > ColorSpaceGray
> > and also has a flag called Caching, which both seem like attributes that I
> > would want to use. I have not found much documentation or examples on how
> > they can be used. Can anyone point me in the correct direction?
> >
> > From the Win32 app, I saved a bitmap of an image then constructed a .Net
> > image by reading that file. I noticed that imaged was created with the
> > PixelFormat.Format8bppIndexed and was using a grayscale color palette. It
> > that the better method of setting up and display grayscale images?
> >
> > Am I on the right track, or should I be taking a different approach?
> >
> > Any thoughts will be appreciated.
>
>
>