我正在尝试用PHP读取.psd文件。我从http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/#50577409_72092获得了完整的标题信息,我有文件的签名,版本,频道,高度和宽度,深度和颜色模式。
这是我的PHP代码:
$infoArray = array();
$fileName = "test.psd";
$fp = fopen($fileName,'r');
$infoArray['version id'] = @reset(unpack('n',fread($fp,2)));
fseek($fp,6,SEEK_CUR);
$infoArray['channels'] = @reset(unpack('n',fread($fp,2)));
$infoArray['rows'] = @reset(unpack('N',fread($fp,4)));
$infoArray['columns'] = @reset(unpack('N',fread($fp,4)));
$infoArray['colorDepth'] = @reset(unpack('n',fread($fp,2)));
$infoArray['colorMode'] = @reset(unpack('n',fread($fp,2)));
如何提取名称,高度,宽度,x坐标和y坐标的图层,然后将这些图层导出为.png文件?