C++
C#
VB
JScript
All

File Formats


Copyright (C) 2005 IENT-RWTH Aachen

Include every corresponding header file of the formats you need.

GENIAL provides 3 image formats (PBM, PGM, PPM).

GENIAL can also manipulate five other formats with the Windows GDI+ (BMP, GIF, JPG, PNG, TIF). In this case, include the 'ioimage.h' header file after all other include statements, and do not forget to link the GDI+ library (gdiplus.lib) with your project.

The format to use can be chosen from the suffix of the file name. In this case, include the 'ioimage.h' header file after all other include statements.

Example

The following example loads an image and saves it in another format. An exception is thrown if any problem occurs.

#include "image/jpg.h"
#include "image/ppm.h"
#include "image/ioimage.h"

int main()
{
  catch
  {
    JPGFile fin("x.jpg");
    RGBImage X;
    fin >> X; // loads "x.jpg"
      
    PPMFile fout("y.ppm");
    fout << X;
  } catch (const error &e) { cout << e.what() << endl; return 1; }
  return 0;
}

Example

The following example does the same as the previous one, except that it considers the suffix of the image name.

#include "image/jpg.h"
#include "image/ppm.h"
#include "image/ioimage.h"
    
int main()
{
  catch
  {
    ImageFile fin("x.jpg");
    RGBImage X;
    fin >> X; // loads "x.jpg"
      
    ImageFile fout("y.ppm");
    fout << X;
  } catch (const error &e) { cout << e.what() << endl; return 1; }
  return 0;
}

Class BMPFile

BMP format

Class GIFFile

GIF format

Class JPGFile

JPG format

Class PBMFile

PBM format

Class PGMFile

PGM format

Class PNGFile

PNG format

Class PPMFile

PPM format

Class TIFFile

TIF format

See Also

Images