Photoshop:如何处理大量杂乱无章的物品的编号? [英] Photoshop: How to handle numbering a large amount of disorganized items?

查看:75
本文介绍了Photoshop:如何处理大量杂乱无章的物品的编号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有一个大型露营地,例如座位"图表,其中有数百个地段被切开并在Photoshop中进行了概述.(每个批次大约是一个正方形)每个批次都需要在photoshop中编号,并且在将来进行更改时也可以进行编辑.批次分散且围绕景观弯曲,因此似乎可以在一层中输入文本,因为例如批次27位于右侧并旋转20度以匹配批次,而批次185则可能位于左侧,相差很大角度.

是否有一种优雅的方法来执行此操作,或者至少快速导入一个在每个图层上放置一个数字的大数字序列,以便我可以抓住它们并将它们快速定位到相应的位置,而不必逐个键入然后分别定位数字?我在想一种在Photoshop中处理该问题的优雅/快捷方式时遇到麻烦...


编辑 1 - 图片:

在这里询问您要多少个数字:

 //Setchell-AddNumbers-Adobe Photoshop脚本//说明:询问用户要添加的数字数量,每个数字都位于自己的图层中//版本:0.1//作者:Mark Setchell(mark@thesetchells.com)//网址:http://www.thesetchells.com//===========================================================================//安装://1.将脚本放在"C:\ Program Files \ Adob​​e \ Adob​​e Photoshop CS#\ Presets \ Scripts \"中//2.重新启动Photoshop//3.选择文件>脚本>加号//===========================================================================//从Mac Finder或Windows资源管理器中启用双击//此命令仅在Photoshop CS2和更高版本中有效#target photoshop//使应用程序前进以进行双击事件app.bringToFront();/////////////////////////////////////////////////////////////////////////////////////AddNumbers///////////////////////////////////////////////////////////////////////////////////函数AddNumbers(){//更改Debug = 1以获得更多调试消息var Debug = 1;//让用户输入JPEG名称的通用词干var dialog = new Window('dialog','Setchell-AddNumbers');dialog.size = {width:500,height:100};dialog.stem = dialog.add('edittext',undefined,'<输入结束号码>');;dialog.stem.size = {width:400,height:25};dialog.stem.value = true;dialog.stem.buildBtn = dialog.add('button',undefined,'OK',{name:'ok'});dialog.show();//提取用户输入的内容-仅数字var limit = dialog.stem.text.match(/\ d +/);//调试如果(调试)警告(限制);var cnt;var n = 0;var nPer = 10;var deltaX = app.activeDocument.width/nPer;var deltaY = app.activeDocument.height/nPer;var tX = 0;var tY=deltaY;app.preferences.typeUnits = TypeUnits.POINTS;for(cnt = 1; cnt< = limit; cnt ++){//在活动文档中添加一个新层,并将其存储在名为"myTextLayer"的变量中.var myTextLayer = app.activeDocument.artLayers.add();//将myTextLayer从普通图层更改为文本图层.myTextLayer.kind = LayerKind.TEXT;//获取对myTextLayer的textItem属性的引用.var myText = myTextLayer.textItem;//将文本的字体大小设置为16.myText.size = 16;//设置textItem的内容.myText.contents = cnt;//放置标签-可以改善:-)tX = n * deltaX;myText.position = new Array(tX,tY);n ++;if(n == nPer){tY + = deltaY;n = 0;}}返回;}/////////////////////////////////////////////////////////////////////////////////////isCorrectVersion-检查Adobe Photoshop CS2(v9)或更高版本///////////////////////////////////////////////////////////////////////////////////函数isCorrectVersion(){如果(parseInt(version,10)> = 9){返回true;}别的 {alert('此脚本需要Adobe Photoshop CS2或更高版本.','Wrong Version',false);返回false;}}/////////////////////////////////////////////////////////////////////////////////////showError-如果出现问题,则显示错误消息///////////////////////////////////////////////////////////////////////////////////函数showError(err){如果(确认('发生未知错误.\ n'+您想查看更多信息吗?",是,未知错误")){alert(err + ': on line ' + err.line, 'Script Error', true);}}//在运行main函数之前测试初始条件如果(isCorrectVersion()){//保存当前的RulerUnits,以在完成后还原var savedRulerUnits = app.preferences.rulerUnits;//将RulerUnits设置为PIXELSapp.preferences.rulerUnits = Units.PIXELS;尝试 {AddNumbers();}抓住{e} {//不要在用户取消时报告错误if(e.number!= 8007){showError(e);}}//将RulerUnits恢复为开始时的状态app.preferences.rulerUnits = savedRulerUnits;} 

Suppose I have a large campsite like "seating" chart with several hundred lots sectioned off and outlined in photoshop. (each lot is roughly a square) Every lot needs to be numbered in photoshop and also editable in the future in case of changes. The lots are scattered and curve around the landscape so entering text in one layer seems out since for example lot 27 with be on the right and rotate 20 degrees to match the lot and yet lot 185 might be way over on the left at a far different angle.

Is there an elegant way to do this or at least quickly import a large number sequence that places one number per layer so I can grab them and orient them to their corresponding lot quickly instead of typing out and then positioning ever number individually? I'm having trouble thinking up an elegant/fast way to handle this in Photoshop...


Edit 1 - picture: http://i.imgur.com/UT3DRBi.jpg

解决方案

You can do it with Extendscript. I am not the best of Extendscript programmers, but the following script will ask you for the number of text labels you want and add that many numbers on sepearate layers. Of course, you can diddle around with the font, colour, position, size etc. but it should get you started.

Here is an example - I turned off layers 4 and 5 so you can see each number is on a new layer.

Here it asks how many numbers you want:

// Setchell - AddNumbers - Adobe Photoshop Script
// Description: Asks user for number of numbers to add, each in own layer   
// Version: 0.1
// Author: Mark Setchell (mark@thesetchells.com)
// Web: http://www.thesetchells.com
// ============================================================================
// Installation:
// 1. Place script in 'C:\Program Files\Adobe\Adobe Photoshop CS#\Presets\Scripts\'
// 2. Restart Photoshop
// 3. Choose File > Scripts > AddNumbers
// ============================================================================

// enable double-clicking from Mac Finder or Windows Explorer
// this command only works in Photoshop CS2 and higher
#target photoshop

// bring application forward for double-click events
app.bringToFront();


///////////////////////////////////////////////////////////////////////////////
// AddNumbers
///////////////////////////////////////////////////////////////////////////////
function AddNumbers() {

    // Change Debug=1 for extra debugging messages
    var Debug=1;

    // Get user to enter common stem for JPEG names
    var dialog = new Window('dialog', 'Setchell - AddNumbers');
    dialog.size = {width:500, height:100};
    dialog.stem = dialog.add('edittext',undefined, '<Enter ending number>');
    dialog.stem.size = {width:400,height:25};
    dialog.stem.value = true;
    dialog.stem.buildBtn = dialog.add('button', undefined,'OK', {name:'ok'});
    dialog.show();

    // Pick up what user entered - just digits
    var limit=dialog.stem.text.match(/\d+/);

    // Debug
    if(Debug)alert(limit);
    var cnt;


    var n=0;
    var nPer=10;
    var deltaX=app.activeDocument.width/nPer;
    var deltaY=app.activeDocument.height/nPer;
    var tX=0;
    var tY=deltaY;

    app.preferences.typeUnits = TypeUnits.POINTS;
    for(cnt=1;cnt<=limit;cnt++){

       // Adds a new layer to the active document and stores it in a variable named "myTextLayer".
       var myTextLayer = app.activeDocument.artLayers.add();

       // Changes myTextLayer from normal to a text layer.
       myTextLayer.kind = LayerKind.TEXT;

       // Gets a reference to the textItem property of myTextLayer.
       var myText = myTextLayer.textItem;

       // sets the font size of the text to 16.
       myText.size = 16;

       // Sets the contents of the textItem.
       myText.contents = cnt;

       // Position the label - could be improved :-)
       tX=n*deltaX;
       myText.position = new Array(tX, tY);
       n++;
       if(n==nPer){
           tY+=deltaY;
           n=0;
       }
    }

return;

}

///////////////////////////////////////////////////////////////////////////////
// isCorrectVersion - check for Adobe Photoshop CS2 (v9) or higher
///////////////////////////////////////////////////////////////////////////////
function isCorrectVersion() {
    if (parseInt(version, 10) >= 9) {
        return true;
    }
    else {
        alert('This script requires Adobe Photoshop CS2 or higher.', 'Wrong Version', false);
        return false;
    }
}



///////////////////////////////////////////////////////////////////////////////
// showError - display error message if something goes wrong
///////////////////////////////////////////////////////////////////////////////
function showError(err) {
    if (confirm('An unknown error has occurred.\n' +
        'Would you like to see more information?', true, 'Unknown Error')) {
            alert(err + ': on line ' + err.line, 'Script Error', true);
    }
}


// test initial conditions prior to running main function
if (isCorrectVersion()) {

    // Save current RulerUnits to restore when we have finished
    var savedRulerUnits = app.preferences.rulerUnits;

    // Set RulerUnits to PIXELS
    app.preferences.rulerUnits = Units.PIXELS;

    try {
        AddNumbers();
    }
    catch(e) {
        // don't report error on user cancel
        if (e.number != 8007) {
            showError(e);
        }
    }

    // Restore RulerUnits to whatever they were when we started
    app.preferences.rulerUnits = savedRulerUnits;
}

这篇关于Photoshop:如何处理大量杂乱无章的物品的编号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆