Click here to Skip to main content
15,895,799 members
Articles / Programming Languages / C#

PixelMap Class and PNM Image Viewer

Rate me:
Please Sign up or sign in to vote.
4.52/5 (14 votes)
28 May 2007CPOL2 min read 76.4K   3.8K   15  
A managed C# class and viewer for working with and converting Portable Bit Map (.pbm), Portable Grey Map (.pgm) and Portable Pixel Map (.ppm) images
<html dir="LTR">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252" />
    <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
    <title>PixelMap</title>
    <xml>
    </xml>
    <link rel="stylesheet" type="text/css" href="MSDN.css" />
  </head>
  <body id="bodyID" class="dtBODY">
    <div id="nsbanner">
      <div id="bannerrow1">
        <table class="bannerparthead" cellspacing="0">
          <tr id="hdr">
            <td class="runninghead">PixelMap Class Library</td>
            <td class="product">
            </td>
          </tr>
        </table>
      </div>
      <div id="TitleRow">
        <h1 class="dtH1">PixelMap Namespace</h1>
      </div>
    </div>
    <div id="nstext">
      <p>
        <a href="PixelMapHierarchy.html">Namespace hierarchy</a>
      </p>
      <h3 class="dtH3">Classes</h3>
      <div class="tablediv">
        <table class="dtTABLE" cellspacing="0">
          <tr valign="top">
            <th width="50%">Class</th>
            <th width="50%">Description</th>
          </tr>
          <tr valign="top">
            <td width="50%">
              <a href="PixelMap.PixelMap.html">PixelMap</a>
            </td>
            <td width="50%"> This class provides a managed C# abstraction for Portable Bit Map (.pbm), Portable Grey Map (.pgm) and Portable Pixel Map (.ppm)images. The class is able to handle P1 (ASCII .pbm), P2 (ASCII .pgm) P3 (ASCII .ppm), P5 (binary .pgm), and P6 (binary .ppm) files and streams. P4 (binary .pbm) is not supported. The class can process normal images, which have widths that are multiples of 4 pixels wide, and can also handle "off-size" images using a less efficient algorithm. It presents .pbm and .pgm images using the 8bppIndexed pixel format, and presents .ppm images using the 24bppRGB pixel format. It can convert these images into a visually pleasing greyscale bitmap image (in a less efficient 24bppRGB pixel format), which is accessible using the GreyMap property. To use this class: 1. Copy the PixelMap.cs file into your own project. 2. Change the namespace of the class (above this summary) from "PixelMap" to the namespace of your project. 3. Compile. This class is used by the PixelMapViewer application. </td>
          </tr>
        </table>
      </div>
      <h3 class="dtH3">Structures</h3>
      <div class="tablediv">
        <table class="dtTABLE" cellspacing="0">
          <tr valign="top">
            <th width="50%">Structure</th>
            <th width="50%">Description</th>
          </tr>
          <tr valign="top">
            <td width="50%">
              <a href="PixelMap.PixelMap.PixelMapHeader.html">PixelMap.PixelMapHeader</a>
            </td>
            <td width="50%"> This struct contains the objects that are found in the header of .pbm, .pgm, and .ppm files. </td>
          </tr>
        </table>
      </div>
      <hr />
      <div id="footer">
        <p>
          <a href="mailto:StephenBogner@shaw.ca?subject=PixelMap%20Class%20Library%20Documentation%20Feedback:%20PixelMap%20Namespace">Send comments on this topic.</a>
        </p>
        <p>
          <a>(c) Copyright 2007 Stephen Bogner. This is an Open Source Contribution.  Use as you see fit, at your own risk.</a>
        </p>
        <p>
        </p>
      </div>
    </div>
  </body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Engineer Defence R&D Canada
Canada Canada
Stephen Bogner is a Senior Research Engineer with Defence R&D Canada. As the Head Autonomous Applications Group, Autonomous Intelligent Systems Section, he only programs when it can't be avoided, and then only in C#.

Comments and Discussions