如何通过Photoshop脚本中的坐标选择对象?并使用内容意识填充删除?

发布于 2025-01-20 17:33:25 字数 96 浏览 1 评论 0原文

我有多个图像,上面有文字。我有每个单词的坐标为顶部,左,宽度和高度。如何选择每个单词(使用坐标)并使用内容意识填充将其删除。我应该从哪里开始?使用操作,脚本,插件或其他任何内容?

I have multiple images with text on them. I have coordinates of each word as top, left, width and height. how can I select each word (using coordinates) and remove it using content aware fill. where I should start? using action, script, plugin or anything else?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

掌心的温暖 2025-01-27 17:33:25

希望这能达到您想要的效果:

// Switch off any dialog boxes
displayDialogs = DialogModes.NO; // OFF 

var top = 10; // change these to your own coordinates
var left = 15;
var width = 75;
var height = 20;

// select a rectangle with the above coordinates
select_rectangle(top, left, top+height, left+width);

// content fill
content_fill();


// function SELECT RECTANGLE(top, left, bottom, right)
// --------------------------------------------------------
function select_rectangle(top, left, bottom, right)
{
  // Note: co-ordinates are same as script listener
  // and not so human-friendly as t,l,r,b.

  // deselect EVERYTHING first
  app.activeDocument.selection.deselect();

  // =======================================================
  var id1 = charIDToTypeID( "setd" );
  var desc1 = new ActionDescriptor();
  var id2 = charIDToTypeID( "null" );
  var ref1 = new ActionReference();
  var id3 = charIDToTypeID( "Chnl" );
  var id4 = charIDToTypeID( "fsel" );
  ref1.putProperty( id3, id4 );
  desc1.putReference( id2, ref1 );
  var id5 = charIDToTypeID( "T   " );
  var desc2 = new ActionDescriptor();
  var id6 = charIDToTypeID( "Top " );
  var id7 = charIDToTypeID( "#Pxl" );
  desc2.putUnitDouble( id6, id7, top );
  var id8 = charIDToTypeID( "Left" );
  var id9 = charIDToTypeID( "#Pxl" );
  desc2.putUnitDouble( id8, id9, left );
  var id10 = charIDToTypeID( "Btom" );
  var id11 = charIDToTypeID( "#Pxl" );
  desc2.putUnitDouble( id10, id11, bottom );
  var id12 = charIDToTypeID( "Rght" );
  var id13 = charIDToTypeID( "#Pxl" );
  desc2.putUnitDouble( id12, id13, right );
  var id16 = charIDToTypeID( "Rctn" );
  desc1.putObject( id5, id16, desc2 );

  executeAction( id1, desc1, DialogModes.NO );
}


function content_fill()
{
  // =======================================================
  var idFl = charIDToTypeID( "Fl  " );
  var desc461 = new ActionDescriptor();
  var idUsng = charIDToTypeID( "Usng" );
  var idFlCn = charIDToTypeID( "FlCn" );
  var idcontentAware = stringIDToTypeID( "contentAware" );
  desc461.putEnumerated( idUsng, idFlCn, idcontentAware );
  var idcontentAwareColorAdaptationFill = stringIDToTypeID( "contentAwareColorAdaptationFill" );
  desc461.putBoolean( idcontentAwareColorAdaptationFill, true );   // Color Adaptation
  var idOpct = charIDToTypeID( "Opct" );
  var idPrc = charIDToTypeID( "#Prc" );
  desc461.putUnitDouble( idOpct, idPrc, 100.000000 ); // Opacity
  var idMd = charIDToTypeID( "Md  " );
  var idBlnM = charIDToTypeID( "BlnM" );
  var idNrml = charIDToTypeID( "Nrml" ); // Normal
  desc461.putEnumerated( idMd, idBlnM, idNrml );
  executeAction( idFl, desc461, DialogModes.NO );
}

Hopefully this will do what you want:

// Switch off any dialog boxes
displayDialogs = DialogModes.NO; // OFF 

var top = 10; // change these to your own coordinates
var left = 15;
var width = 75;
var height = 20;

// select a rectangle with the above coordinates
select_rectangle(top, left, top+height, left+width);

// content fill
content_fill();


// function SELECT RECTANGLE(top, left, bottom, right)
// --------------------------------------------------------
function select_rectangle(top, left, bottom, right)
{
  // Note: co-ordinates are same as script listener
  // and not so human-friendly as t,l,r,b.

  // deselect EVERYTHING first
  app.activeDocument.selection.deselect();

  // =======================================================
  var id1 = charIDToTypeID( "setd" );
  var desc1 = new ActionDescriptor();
  var id2 = charIDToTypeID( "null" );
  var ref1 = new ActionReference();
  var id3 = charIDToTypeID( "Chnl" );
  var id4 = charIDToTypeID( "fsel" );
  ref1.putProperty( id3, id4 );
  desc1.putReference( id2, ref1 );
  var id5 = charIDToTypeID( "T   " );
  var desc2 = new ActionDescriptor();
  var id6 = charIDToTypeID( "Top " );
  var id7 = charIDToTypeID( "#Pxl" );
  desc2.putUnitDouble( id6, id7, top );
  var id8 = charIDToTypeID( "Left" );
  var id9 = charIDToTypeID( "#Pxl" );
  desc2.putUnitDouble( id8, id9, left );
  var id10 = charIDToTypeID( "Btom" );
  var id11 = charIDToTypeID( "#Pxl" );
  desc2.putUnitDouble( id10, id11, bottom );
  var id12 = charIDToTypeID( "Rght" );
  var id13 = charIDToTypeID( "#Pxl" );
  desc2.putUnitDouble( id12, id13, right );
  var id16 = charIDToTypeID( "Rctn" );
  desc1.putObject( id5, id16, desc2 );

  executeAction( id1, desc1, DialogModes.NO );
}


function content_fill()
{
  // =======================================================
  var idFl = charIDToTypeID( "Fl  " );
  var desc461 = new ActionDescriptor();
  var idUsng = charIDToTypeID( "Usng" );
  var idFlCn = charIDToTypeID( "FlCn" );
  var idcontentAware = stringIDToTypeID( "contentAware" );
  desc461.putEnumerated( idUsng, idFlCn, idcontentAware );
  var idcontentAwareColorAdaptationFill = stringIDToTypeID( "contentAwareColorAdaptationFill" );
  desc461.putBoolean( idcontentAwareColorAdaptationFill, true );   // Color Adaptation
  var idOpct = charIDToTypeID( "Opct" );
  var idPrc = charIDToTypeID( "#Prc" );
  desc461.putUnitDouble( idOpct, idPrc, 100.000000 ); // Opacity
  var idMd = charIDToTypeID( "Md  " );
  var idBlnM = charIDToTypeID( "BlnM" );
  var idNrml = charIDToTypeID( "Nrml" ); // Normal
  desc461.putEnumerated( idMd, idBlnM, idNrml );
  executeAction( idFl, desc461, DialogModes.NO );
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文