Hi,
 
I am reading Photoshop layer images using this approach:
 
(simplified code)
 
for (i=0; i <= imageCount; i++)
{
unsigned long offset, size;
GraphicsImportSetImageIndex(importer, i);
GraphicsImportGetDataOffsetAndSize(importer, &offset, &size);
 
// create a Graphics Exporter component that will write Photoshop data
OSErr err = 
OpenADefaultComponent(GraphicsExporterComponentType,kQTFileTypePhotoShop, 
&exporter);
 
if (err == noErr)
{
     // set export parameters
     Handle bmpDataH = NewHandle(0);
     GraphicsExportSetInputGraphicsImporter(exporter, importer);
     GraphicsExportSetOutputHandle(exporter, bmpDataH);
 
     // export data to BMP into handle
     unsigned long actualSizeWritten = 0;
     err = GraphicsExportDoExport(exporter, &actualSizeWritten);
 
          if (err == noErr)
          {
 
               HLock(bmpDataH);
 
               //create a simple image with the tiff data, without the bound 
information, its rep will stored to layer as CGImageRef
               id image = [CIImage imageWithData:[NSData 
dataWithBytes:*bmpDataHlength:GetHandleSize(bmpDataH)]];
               NSBitmapImageRep* rep = [[[NSBitmapImageRep alloc] 
initWithCIImage:image]autorelease];
 
               CGImageRef imageRef = rep.CGImage;
               self.layerImage =CGImageRetain(imageRef);
               HUnlock(bmpDataH);
         }
 
     DisposeHandle(bmpDataH);
     CloseComponent(exporter);
     }
 
}
 
It works as expected, but when I open a psd file that has layers with TEXT (not 
rendered) and in CMYK color space, it looks like alpha channel of such layer is 
igonred and I'm getting a black rect instead (with text on top of it).
 
I have read in some old post (2005) that is is a bug in Apple importer. 
The fact is that I didn't find other way how to read in images from psd files.
 
A. Is there any tip how to fix the CMYK-TEXT alpha problem I described ?
B. Is there any other way how to read photoshop layer images ?
 
Thank you.
 
Peter_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to