> I have the code written ...to import PICT files, to alter the images and to
> save them as PICT resources. Now I want to know how to open a JPEG file and
> turn it into a PICT file.
PicHandle ph = NULL;
ImageFileToPicHandle(&fs, &ph);, where ImageFileToPicHandle is as below.
Add the Quicktime library to your project.
#include <ImageCompression.h>
OSStatus ImageFileToPicHandle(const FSSpec *fsp, PicHandle *outPHp){
GraphicsImportComponent gi = NULL;
OSStatus stat = noErr;
if(noErr == stat){ stat = GetGraphicsImporterForFile(fsp, &gi); }
if(noErr == stat){ stat = GraphicsImportGetAsPicture(gi, outPHp); }
if(NULL != gi){ CloseComponent(gi); }
return stat;
}
To save it as a PICT _File_, use:
GraphicsImportExportImageFile();
It uses the output filetype to figure out how to re-encode the image.
The symbolic constants like kQTFileTypeJPEG are in
#include <QuicktimeComponents.h>
This will work with PNGs, GIFs, PICTs, JPEGs, BMPs, TIFFs: any of the
long list of file types that QuicktimeGraphicImporters handle.