如何批量合并两个独特的一系列图像到Photoshop中的单面并排形象? [英] How to batch combine two unique series of images into a single side-by-side image in Photoshop?

查看:220
本文介绍了如何批量合并两个独特的一系列图像到Photoshop中的单面并排形象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要合并两个一系列影像(两者相同的分辨率,保存为JPG文件)与图像并排彼此一个JPG文件。我曾尝试用Photoshop CS6的行动这样做,但无济于事......我已经寻找可能的解决方案互联网,但事实证明,需要编程知识来编写一个脚本来执行这样的功能。我想有任何帮助,可能与以下内容:

I need to combine two series of images (both the same resolution, saved as JPG files) into a single JPG file with the images side by side to each other. I have tried doing this with Photoshop CS6 actions but to no avail... I have searched the internet for possible solutions but as it turns out programming knowledge is required to write a script to perform such a function. I would like to have any help possible with the following:

我的文件名是这样:

系列之一:bone00001.jpg,bone00002.jpg ... bone00060.jpg
系列二:st00001.jpg,st00002.jpg ... st00060.jpg

Series one: bone00001.jpg, bone00002.jpg ... bone00060.jpg Series two: st00001.jpg, st00002.jpg ... st00060.jpg

我想,这样的骨头系列是在左边结合他们并排,而ST系列是在右边,而最终系列导出为done00001.jpg ... done00060.jpg

I want them combined side by side so that the "bone" series is on the left, and the "st" series is on the right, and the final series exported as done00001.jpg ... done00060.jpg

会有人能够帮助我的Photoshop脚本?

Would anyone be able to help me with this Photoshop script?

推荐答案

亚当D是正确的 - 你最好问在的的Adobe论坛。但作为幸运的是你的要求是非常相似的<一个href=\"http://stackoverflow.com/questions/13530943/merging-files-together-side-by-side-in-folder-photoshop-scripts\">a问问题而回。
剧本是原油;但它会做你想要什么:
的图像需要具有相同的尺寸。如果骨骼图像比扫描图象更小,它会看起来很乱,将无法正常工作。

Adam D is right - you're better off asking at the Adobe forums. But as luck would have it your request is very similar to a question asked a while back. The script is crude; but it will do what you want: The images need to be the same size. If the bone images are smaller than the scan images it'll look a mess and won't work.

保存此作为出文件.jsx。它可以在PS从文件>脚本菜单进行访问。

Save this out as .jsx file. It can be accessed within PS from the file > scripts menu.

加载骨图像之一,运行脚本 - 然后将找到匹配的扫描图像,并通过边把它们端和出保存为bone_XXXX_done.jpg(XXXX为数字)

Load in one of the bone images, run the script - which will then find the matching scan image and put them side by side and save them out as bone_XXXX_done.jpg (where XXXX is number)

    var srcDoc = app.activeDocument;

// call the current document
var srcDoc = app.activeDocument;

// set original width and height
var imageW = srcDoc.width.value;
var imageH = srcDoc.height.value;

// get the info out of the source doc
var fileName = srcDoc.name;
var docName = fileName.substring(0,fileName.length -4);
var filePath = srcDoc.path.toString();
var fileExt = fileName.substring(fileName.length -4, fileName.length);

var nameCheck = fileName.substring(0,fileName.indexOf("bone"));

if (nameCheck <1)
{
   var fileNum = fileName.substring(4,fileName.length -4);
   // no underscore so we need to open it's namesake
   // alert(nameCheck)
   var filePair = filePath + "/" + "st" + fileNum + fileExt;
   openThisFile(filePair)
   activeDocument.selection.selectAll()
   activeDocument.selection.copy();
   app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
   app.activeDocument = srcDoc;
   activeDocument.resizeCanvas(imageW *2, imageH, AnchorPosition.MIDDLELEFT);
   selectRect(0, imageW, imageW*2, imageH)
   activeDocument.paste()
   activeDocument.flatten();
   var newName = filePath + "/" + docName + "_done" + fileExt
   saveMe(newName)
}
    else
    {
      app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
    }


function openThisFile(masterFileNameAndPath)
{
 var fileRef = new File(masterFileNameAndPath)
 if (fileRef.exists)
 //open that doc
 {
    app.open(fileRef);
 }
 else
 {
    alert("error opening " + masterFileNameAndPath)
 }
}


function selectRect(top, left, right, bottom)
{
    srcDoc.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 saveMe(fPath)
{

// save out the image as jpeg
var jpgFile = new File(fPath);
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = 12;

activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);

// close that saved jpg
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}

这篇关于如何批量合并两个独特的一系列图像到Photoshop中的单面并排形象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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