Table of Contents

NAME

QccIMGImageDetermineType, QccIMGImageRead, QccIMGImageWrite - read/write image to/from file

SYNOPSIS

#include "libQccPack.h"

int QccIMGImageDetermineType(QccIMGImage *image);

int QccIMGImageRead(QccIMGImage *image);
int QccIMGImageWrite(QccIMGImage *image);

DESCRIPTION

QccIMGImageDetermineType() attempts to determine the type of the image, setting the image->image_type field appropriately. First, QccIMGImageDetermineType() checks to see whether image->image_type is already set to something other than QCCIMGTYPE_UNKNOWN. If it is, QccIMGImageDetermineType() returns immediately, making no changes to image. Otherwise, if image->image_type is equal to QCCIMGTYPE_UNKNOWN, QccIMGImageDetermineType() checks to see whether the file indicated by image->filename exists. If it does, it reads the magic number from the file, and sets image->image_type to QCCIMGTYPE_PPM, QCCIMGTYPE_PGM, QCCIMGTYPE_PBM, or QCCIMGTYPE_ICP according to the magic number, or to QCCIMGTYPE_UNKNOWN if the magic number is not recognized. On the other hand, if the file does not exist, QccIMGImageDetermineType() attempts to determine the image type from the filename itself. If filename ends in ".ppm", image->image_type is set to QCCIMGTYPE_PPM. If filename ends in ".pgm", image->image_type is set to QCCIMGTYPE_PGM. If filename ends in ".pbm", image->image_type is set to QCCIMGTYPE_PBM. If filename ends in ".icp", image->image_type is set to QCCIMGTYPE_ICP. Otherwise, image->image_type is set to QCCIMGTYPE_UNKNOWN.

QccIMGImageRead() reads a QccIMGImage structure from the file specified by image->filename. QccIMGImageDetermineType() is called to determine the image file's type, and then the appropriate steps are taken to read the specific file format.

QccIMGImageWrite() writes a QccIMGImage structure to a file; the filename of the image file to be written must be stored as image->filename. QccIMGImageDetermineType() is called to determine the image file's type, and then the appropriate steps are taken to write the specific file format.

RETURN VALUES

These routines return 0 on success and 1 on error.

SEE ALSO

QccIMGImage(3) , QccPackIMG(3) , QccPack(3)

AUTHOR

Copyright (C) 1997-2021 James E. Fowler


Table of Contents



Get QccPack at SourceForge.net. Fast, secure and Free Open Source software downloads