我正在尝试像这样获取 SolidColor(或有时是 SolidFill)ArtLayers 的颜色值:
$app = new \COM('Photoshop.Application');
$doc = $app->ActiveDocument;
foreach ($doc->ArtLayers as $layer) {
if ($layer->Kind == 3) { // which means Solid Color Layer
echo $layer->Name.': '.$layer->SolidColor;
}
}
我尝试了很多方法,如 $layer->Color、$layer->FillColor、$layer->Fill->Color 等作为方法或属性,总是抛出错误:
Fatal error: Uncaught com_exception: Unable to lookup `Color'
或
Fatal error: Uncaught Error: Call to undefined method variant::Color()
没有这方面的文档; get_object_vars、get_class_methods 等总是返回空数组,或抛出错误,Photoshop 保持沉默它本身有什么......
如何使用 PHP Com 类在 Photoshop 中获取/设置 SolidColor ArtLayer?如何找到克服所有错误的正确方法?