【发布时间】:2014-10-07 18:22:44
【问题描述】:
我有一张图片,其中包括一些图片(这里和那里的大小不同)在纯白色背景上,全部在 1 层中。
我可以用 Photoshop 分离/提取所有图片吗?
提前谢谢你,
【问题讨论】:
标签: photoshop photoshop-script photoshop-cs5
我有一张图片,其中包括一些图片(这里和那里的大小不同)在纯白色背景上,全部在 1 层中。
我可以用 Photoshop 分离/提取所有图片吗?
提前谢谢你,
【问题讨论】:
标签: photoshop photoshop-script photoshop-cs5
是的,不是的。找出每个单独图像的位置将非常困难(并且可能涉及扫描每个像素的缓慢复杂过程)
但是有办法解决它!在没有看到这些图像的情况下,我们假设
你可以选择左上角的魔杖,反转选择并剪切图像。
//select top left hand corner
magicWand(0,0);
// inverse selection
activeDocument.selection.invert();
//copy image
activeDocument.selection.cut();
function magicWand(x,y)
{
var id4109 = charIDToTypeID( "setd" );
var desc623 = new ActionDescriptor();
var id4110 = charIDToTypeID( "null" );
var ref398 = new ActionReference();
var id4111 = charIDToTypeID( "Chnl" );
var id4112 = charIDToTypeID( "fsel" );
ref398.putProperty( id4111, id4112 );
desc623.putReference( id4110, ref398 );
var id4113 = charIDToTypeID( "T " );
var desc624 = new ActionDescriptor();
var id4114 = charIDToTypeID( "Hrzn" );
var id4115 = charIDToTypeID( "#Pxl" );
desc624.putUnitDouble( id4114, id4115, x );
var id4116 = charIDToTypeID( "Vrtc" );
var id4117 = charIDToTypeID( "#Pxl" );
desc624.putUnitDouble( id4116, id4117, y );
var id4118 = charIDToTypeID( "Pnt " );
desc623.putObject( id4113, id4118, desc624 );
var id4119 = charIDToTypeID( "Tlrn" );
desc623.putInteger( id4119, 0 );
executeAction( id4109, desc623, DialogModes.NO );
}
【讨论】: