Page 1 of 1

Accessing properties of a PSD layer throws exception

Posted: 2009-11-06T13:51:31-07:00
by bslayerw
I'm trying to extract all the layers out of a PSD and save as separate files using the layer's name as the filename. However, when accessing the "properties" property of the Image I get the following exception:

(Mac OX Snow Leopard 10.6.1)
ImageMagick @6.5.7-0_0+q16
rb-rmagick @2.9.0_0

Code: Select all

psd_to_png.rb:27:in `properties': Pixel cache allocation failed `art/MyArtworkwithAbout40Layers.psd' @ cache.c/OpenPixelCache/3842 (Magick::ImageMagickError)
here's my dead simple script to duplicate:

Code: Select all


require 'RMagick'
require 'optparse'
include Magick



psd = ImageList.new("art/MyArtworkwithAbout40Layers.psd").each do |layer|
    layer.properties.each {|k,v|
      puts "#{k} = #{v}\n" 
    }
end


I have no idea what this error means or even how to start debugging it. The PSD file is 9.8 MB, 320x480 px. Here are some of the other properties I was able to extract before it bombed on the 3rd layer:

Code: Select all

stRef:versionID = 1
photoshop:ColorMode = 3
exif:PixelYDimension = 480
tiff:Compression = 6
xapMM:DocumentID = adobe:docid:photoshop:70bebb2f-8184-11de-bfeb-ef6adedc1e11
tiff:NativeDigest = 256,257,258,259,262,274,277,284,530,531,282,283,296,301,318,319,529,532,306,270,271,272,305,315,33432;F984928021D46AF0F73231C467E37E8F
xapMM:InstanceID = uuid:8241C86853CCDE1198169D7766EB2DB4
exif:PixelXDimension = 320
tiff:JPEGInterchangeFormat = 302
stRef:instanceID = uuid:70bebb2c-8184-11de-bfeb-ef6adedc1e11
photoshop:History = 
xap:ModifyDate = 2009-11-06T10:43:16-08:00
tiff:JPEGInterchangeFormatLength = 0
exif:ColorSpace = -1
date:modify = 2009-11-06T10:43:32-08:00
xap:MetadataDate = 2009-11-06T10:43:16-08:00
date:create = 2009-11-06T10:43:32-08:00
xap:CreateDate = 2009-08-05T00:16:20-08:00
exif:NativeDigest = 36864,40960,40961,37121,37122,40962,40963,37510,40964,36867,36868,33434,33437,34850,34852,34855,34856,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386,37396,41483,41484,41486,41487,41488,41492,41493,41495,41728,41729,41730,41985,41986,41987,41988,41989,41990,41991,41992,41993,41994,41995,41996,42016,0,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,20,22,23,24,25,26,27,28,30;2D9AAE147F0EB779116A086A07E942FC
dc:format = application/vnd.adobe.photoshop
xap:CreatorTool = Adobe Photoshop CS3 Macintosh
stRef:documentID = adobe:docid:photoshop:70bebb2b-8184-11de-bfeb-ef6adedc1e11
any help would be much appreciated.