Joe Lertola wrote: > > The file is automatically opened with in fn importImage > A CGContextRef is then created with fn MyCreateCGBitmapContext > From what I can tell a CGContextRef is a Core Graphics equivalent of > a gworld. A CGBitmapContext is the equivalent of a GWorld. A CGContextRef refers to a general graphics environment, which may or may not be a CGBitmapContext. > To demonstrate direct pixel access I poke values into one vertical > column and one horizontal row of the CGContextRef. > One mystery here is that if I poke zero into the four values that > make up a pixel (RGBA) I expect to get black in the image. Instead I > get a medium gray line. If I poke 255 instead I get white as I would > expect. The 4th byte is alpha. If you set it to 0, you see through the image to the metal window background. > Lastly I want to export the image as a new file. Here's how I save a GWorld image as a file. The format parameter may be _"PICT" _"TIFF" _"JPEG" _"GIFf" _"PNTG" etc local fn WriteGWImageToFile( fileSpec as ^FSSpec, format as OSType, gw as CGrafPtr ) dim as GraphicsExportComponent @ ge dim as ComponentResult err, ignore err = fn OpenADefaultComponent( _"grex", format, @ge ) long if ( err == _noErr ) err = fn GraphicsExportSetInputGWorld( ge, gw ) if ( err == _noErr ) then err = fn GraphicsExportSetOutputFile( ge, #fileSpec ) if ( err == _noErr ) then err = fn GraphicsExportDoExport( ge, #0 ) ignore = fn CloseComponent( ge ) end if end fn = err You would use GraphicsExportSetInputCGBitmapContext instead of GraphicsExportSetInputGWorld. The C declaration is: extern ComponentResult GraphicsExportSetInputCGBitmapContext( GraphicsExportComponent ci, CGContextRef bitmapContextRef); Implementing it will need the function-pointer-and-glue palaver that you already use for GraphicsImportCreateCGImage. Robert P.