JPEG Helper Functions

There are two helper functions that work with JPEG files. The fg_jpeghead() function retrieves a JPEG file header. The first fg_jpeghead() parameter is the name of a JPEG file (terminated by a zero byte), and the second is the name of a buffer that will receive the JPEG header (the buffer size must be at least 10 bytes). If successful, fg_jpeghead() returns zero. Otherwise, the return value is -1 if the specified file was not found, or -2 if it is not a baseline JPEG file.

The fg_jpegsize() function returns the width and height of a JPEG image. Its first parameter is the name of a buffer containing the JPEG file header, and its second and third parameters receive the image width and height in pixels. If the JPEG file header is not valid, fg_jpegsize() returns -1 for the width and height parameters.

<< Prev

Next >>

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.