2

I have been trying to create a decoder that will stream through a pcx file and display it on screen as a bitmap. I have managed to get the information from the image header by using a binary reader, but I have now reached the part that seems to take the least amount of code, yet is also the hardest: creating an array of pixels.

I understand that i may need to add two embeddded for loops to process the data. I have looked at some C and C++ examples, but struggle to understand them. I also need to get the array to display it. if you need more code then I will share it.

I have searched far and wide and read the spec, but I don't know how to approach this. If anyone could help me, I would be very grateful.

Regards.

jbroun
  • 21
  • 1
  • 2
  • What sort of PCX files are you trying to read? Everything, or are you able to skip planes/palettes? It's not too hard in the abstract case. Create a Color[,] array to hold the actual pixel data, then loop through rows looping through columns to load individual planes/pixels. – ChrisV Jan 21 '11 at 20:09
  • 6
    I thought when that meteorite wiped out the dinosaurs all PCX files were gone too. – detunized Jan 21 '11 at 20:24
  • I don't mind just 8-bit images and i wasn't sure whether the palette was essential. Will your method work for other formats though? – jbroun Jan 21 '11 at 20:31

2 Answers2

0

http://magick.codeplex.com/

a nice wrapper working with http://imagemagick.codeplex.com/

easy to setup and get going, see samples at the bottom of the page here: http://magick.codeplex.com/documentation

NiceCall
  • 21
  • 5
0

The .NET does not support PCX images natively, you have two choices. Read the specification and decode the image by yourself or use some library.

As suggested on bytes.com you can use Dot Net Fireball (a Free Image wrapper) and load the image like this:

Fireball.Drawing.FreeImage freeImage = new FreeImage(@"c:\test.pcx");
Image image = freeImage.GetBitmap();
Binus
  • 1,065
  • 7
  • 14