Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / August 2003



Tip: Looking for answers? Try searching our database.

JPEG to PICT

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rick Tschudin - 29 Aug 2003 16:48 GMT
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.

Rick T.
David Phillip Oster - 29 Aug 2003 17:38 GMT
> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.