Groups | Blog | Home
all groups > dotnet drawing api > may 2005 >

dotnet drawing api : Save / Write a PCX file from an Image


garyalfred
5/11/2005 11:29:04 AM
I need to write out an 8bit PCX file from an Image or Bitmap object
i've created using a GraphicsPath. I had hoped it would be as easy as
saving it out using an ImageFormat member, but alas there is no PCX
ImageFormat member.

[quoted text, click to view]
at a time. I've really no idea on how to proceed. I've never worked
with byte data directly so the suggestions on writing out the file
header, image data and palette only partial makes sense to me.

Can anyone give me pointers or resources that might help explain the
process of going from Image to PCX file using the dotNET framework?

Thanks in advance for any help.
Bob Powell [MVP]
5/12/2005 12:00:00 AM
PCX files are designed to mimic the frame-buffer format of the graphics
hardware that they display on. It was a quick and dirty way of saving images
"back in the day".

This link should help out.
http://courses.ece.uiuc.edu/ece390/books/labmanual/graphics-pcx.html

You'll need to write the information byte by byte to a file. Remember that
the image data will need to be converted from the 24bpp format to the PCX
pixel format. This will probably be easiest and quickest using LockBits to
access the byte buffer of the original image.

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

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

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

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





[quoted text, click to view]

AddThis Social Bookmark Button