Object | +---DJPEGImage
The DJPEGImage class implements methods for reading and writing JPEG images.
#include <stdio.h> #include "ofc/DJPEGImage.h" #include "ofc/DFile.h" int main(int argc, char *argv[]) { DJPEGImage *image = [DJPEGImage new]; DFile *file = [DFile new]; char name[] = "example.jpg"; if ([file open :name :"rb"]) { if ([DJPEGImage isImage :file]) { if ([image open :file]) { printf("\"%s\" is a JPEG image with width:%d height:%d BytesPerPixel:%d Images:%d\n", name, [image width], [image height], [image bytesPerPixel], [image images]); [image close]; } else printf("Could not open image \"%s\".\n", name); } else printf("\"%s\" is not a JPEG image.\n", name); [file close]; } else printf("Could not find \"%s\":%d\n", name, [file error]); [image free]; // Cleanup [file free]; return 0; }