Hello again >I'm not trying to use Temporary Memory. This is miss-type. not is now. Well, the code I want to change is at http://developer.apple.com/techpubs/quicktime/qtdevdocs/RM/rmImageCompMgr.ht m #include <Types.h> #include <Traps.h> #include <Memory.h> #include <Errors.h> #include <FixMath.h> #include "Movies.h" #include "ImageCompression.h" #include "StdCompression.h" #define kMgrChoose 0 PicHandle GetQTCompressedPict (PixMapHandle myPixMap); PicHandle GetQTCompressedPict( PixMapHandle myPixMap ) { long maxCompressedSize = 0; Handle compressedDataH = nil; Ptr compressedDataP; ImageDescriptionHandle imageDescH = nil; OSErr theErr; PicHandle myPic = nil; Rect bounds = (**myPixMap).bounds; CodecType theCodecType = 'jpeg'; CodecComponent theCodec = (CodecComponent)anyCodec; CodecQ spatialQuality = codecNormalQuality; short depth = 0;/* let ICM choose depth */ theErr = GetMaxCompressionSize( myPixMap, &bounds, depth, spatialQuality, theCodecType, (CompressorComponent)theCodec, &maxCompressedSize); if ( theErr ) return nil; imageDescH = (ImageDescriptionHandle)NewHandle(4); compressedDataH = NewHandle(maxCompressedSize); if ( compressedDataH != nil && imageDescH != nil ) { MoveHHi(compressedDataH); HLock(compressedDataH); compressedDataP = StripAddress(*compressedDataH); theErr = CompressImage( myPixMap, &bounds, spatialQuality, theCodecType, imageDescH, compressedDataP); if ( theErr == noErr ) { ClipRect(&bounds); myPic = OpenPicture(&bounds); theErr = DecompressImage( compressedDataP, imageDescH, myPixMap, &bounds, &bounds, srcCopy, nil ); ClosePicture(); } if ( theErr || GetHandleSize((Handle)myPic) == sizeof(Picture) ) { KillPicture(myPic); myPic = nil; } } if (imageDescH) DisposeHandle( (Handle)imageDescH); if (compressedDataH) DisposeHandle( compressedDataH); return myPic; } In FB, PixMapH& = FN GETGWORLDPIXMAP(offScreen&) LONG IF FN GetMaxCompressionSize(PixMapH&,rect,32,spatialQuality&,_"jpeg",_anyCodec,max CompSize&) = _noErr descH& = FN NEWHANDLE _clear(4) LONG IF descH& hndl& = FN NEWHANDLE _clear(maxCompSize&) LONG IF hndl& osErr% = FN MOVEHHI(hndl&) osErr% = FN HLOCK(hndl&) ptr& = FN STRIPADDRESS([hndl&]) LONG IF FN CompressImage(PixMapH&,rect,spatialQuality&,_"jpeg",descH&,ptr&) = _noErr size& = [[descH&]+_iDdataSize&] osErr% = FN HUNLOCK(hndl&) osErr% = FN SETHANDLESIZE(hndl&,size&) XELSE DEF DISPOSEH(hndl&) END IF END IF DEF DISPOSEH(descH&) END IF END IF This routine is sometimes fail at this line... compressedDataH = NewHandle(maxCompressedSize); because maxComprssedSize is very large and out of memory error will occur. This handle will be soon written to disk and then dispose, so I think I have to use temporary handle. TIA. Osamu Shigematsu