Class DImageHeader

Inherits from:
Object
Declared in:
DImageHeader.h

Class Hierarchy

    Object
      |
      +---DImageHeader

Class Description

The DImageHeader class implements a number of methods for determining the type of an image file. Due to the fact that only small tests are performed on the image files, the determination is not full proof. In the future this will become a factory for image objects.

Example:
#include <stdio.h>
#include "ofc/DImageHeader.h"
#include "ofc/DFile.h"

int main(int argc, char *argv[])
{
  DImageHeader *hdr  = [DImageHeader new];
  DFile        *file = [DFile new];

  if ([file open :"example.jpg" :"r"])
  {
    if ([hdr inspect :file])
      printf("File type:%d Mime Type:%s File Extension:%s\n", [hdr type], [hdr mime_type], [hdr extension]);
    else
      printf("No image type could be detected for file \"example.jpg\".\n");

    [file close];
  }
  else
    printf("File \"example.jpg\" could not be opened for inspection.\n");

  [file free];                         // Cleanup
  [hdr  free];

  return 0;
}
Last modified:
02-Aug-2008 (DImageHeader.h)

Instance Variables

private DImageHeaderType _type
the image type (DIM_UNKN,DIM_JPEG,DIM_GIF,DIM_PNG,DIM_BMP,DIM_PCX,DIM_IFF,DIM_RAS,DIM_PBM,DIM_PGM,DIM_PPM,DIM_PSD,DIM_SWF)

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0