这是完成这项工作的脚本。其中大部分是使用脚本侦听器编写的,是的,脚本侦听器代码看起来很糟糕,但是过一段时间您可以将脚本侦听器代码的片段放入并将它们转换为函数。这就是我所做的。您没有指定图像的大小,因此此脚本适用于 100 像素 x 100 像素的图像,并将翻转所选图层。指定坐标的幻数用于选择这行代码。根据您自己的需要进行更改。
如果您有兴趣学习如何为 Photoshop 编写代码,那么我建议您使用(并学习)javaScript。哦,看看脚本监听器。玩得开心。
//Set the preference to be pixels
app.preferences.rulerUnits = Units.PIXELS;
// Call the source document
var srcDoc = app.activeDocument;
// make sure we don't have anything selected first
srcDoc.selection.deselect()
// call the two selected areas
selectThis(33, 0, 33, 67, 33, 67, 100, 67);
// flip the selection horizontally
flipEm()
// function SELECT THIS(top, left, right, bottom)
// --------------------------------------------------------
function selectThis(top1, left1, right1, bottom1, top2, left2, right2, bottom2)
{
// =======================================================
var id8699 = charIDToTypeID( "setd" );
var desc1781 = new ActionDescriptor();
var id8700 = charIDToTypeID( "null" );
var ref1346 = new ActionReference();
var id8701 = charIDToTypeID( "Chnl" );
var id8702 = charIDToTypeID( "fsel" );
ref1346.putProperty( id8701, id8702 );
desc1781.putReference( id8700, ref1346 );
var id8703 = charIDToTypeID( "T " );
var desc1782 = new ActionDescriptor();
var id8704 = charIDToTypeID( "Top " );
var id8705 = charIDToTypeID( "#Pxl" );
desc1782.putUnitDouble( id8704, id8705, top1 );
var id8706 = charIDToTypeID( "Left" );
var id8707 = charIDToTypeID( "#Pxl" );
desc1782.putUnitDouble( id8706, id8707, left1 );
var id8708 = charIDToTypeID( "Btom" );
var id8709 = charIDToTypeID( "#Pxl" );
desc1782.putUnitDouble( id8708, id8709, bottom1 );
var id8710 = charIDToTypeID( "Rght" );
var id8711 = charIDToTypeID( "#Pxl" );
desc1782.putUnitDouble( id8710, id8711, right1 );
var id8712 = charIDToTypeID( "Rctn" );
desc1781.putObject( id8703, id8712, desc1782 );
executeAction( id8699, desc1781, DialogModes.NO );
// =======================================================
var id8779 = charIDToTypeID( "AddT" );
var desc1795 = new ActionDescriptor();
var id8780 = charIDToTypeID( "null" );
var ref1356 = new ActionReference();
var id8781 = charIDToTypeID( "Chnl" );
var id8782 = charIDToTypeID( "fsel" );
ref1356.putProperty( id8781, id8782 );
desc1795.putReference( id8780, ref1356 );
var id8783 = charIDToTypeID( "T " );
var desc1796 = new ActionDescriptor();
var id8784 = charIDToTypeID( "Top " );
var id8785 = charIDToTypeID( "#Pxl" );
desc1796.putUnitDouble( id8784, id8785, top2 );
var id8786 = charIDToTypeID( "Left" );
var id8787 = charIDToTypeID( "#Pxl" );
desc1796.putUnitDouble( id8786, id8787, left2 );
var id8788 = charIDToTypeID( "Btom" );
var id8789 = charIDToTypeID( "#Pxl" );
desc1796.putUnitDouble( id8788, id8789, bottom2 );
var id8790 = charIDToTypeID( "Rght" );
var id8791 = charIDToTypeID( "#Pxl" );
desc1796.putUnitDouble( id8790, id8791, right2 );
var id8792 = charIDToTypeID( "Rctn" );
desc1795.putObject( id8783, id8792, desc1796 );
executeAction( id8779, desc1795, DialogModes.NO );
}
function flipEm()
{
//flip horixontal
// =======================================================
var id8811 = charIDToTypeID( "Flip" );
var desc1800 = new ActionDescriptor();
var id8812 = charIDToTypeID( "null" );
var ref1359 = new ActionReference();
var id8813 = charIDToTypeID( "Lyr " );
var id8814 = charIDToTypeID( "Ordn" );
var id8815 = charIDToTypeID( "Trgt" );
ref1359.putEnumerated( id8813, id8814, id8815 );
desc1800.putReference( id8812, ref1359 );
var id8816 = charIDToTypeID( "Axis" );
var id8817 = charIDToTypeID( "Ornt" );
var id8818 = charIDToTypeID( "Hrzn" );
desc1800.putEnumerated( id8816, id8817, id8818 );
executeAction( id8811, desc1800, DialogModes.NO );
}