0

我有一张图片,其中包括一些图片(这里和那里的大小不同)在纯白色背景上,全部在 1 层中。

我可以用 Photoshop 隔离/提取所有图片吗?

先感谢您,

4

1 回答 1

0

是和不是。找出每个单独图像的位置将非常困难(并且可能涉及扫描每个像素的缓慢复杂过程)

但是有办法解决它!在没有看到这些图像的情况下,我们假设

  • 整个图像都是一层。
  • 单个图像是矩形的
  • 单个图像的边框不包含任何白色

有了它,您可以选择左上角的魔杖,反转选择并剪切图像。

//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 );
}
于 2014-10-08T13:51:37.900 回答