根据网上资源,并与一些编码,下面的脚本能够自动切一个大TIFF成更小的TIFF文件:

#target photoshop

function main(){

if(!documents.length) return;

var dlg=

"dialog{text:'Script Interface',bounds:[100,100,380,290],"+

"panel0:Panel{bounds:[10,10,270,180] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+

"title:StaticText{bounds:[60,10,220,40] , text:'File Chop' ,properties:{scrolling:undefined,multiline:undefined}},"+

"panel1:Panel{bounds:[10,40,250,130] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+

"statictext1:StaticText{bounds:[10,10,111,30] , text:'Accross' ,properties:{scrolling:undefined,multiline:undefined}},"+

"statictext2:StaticText{bounds:[140,10,230,27] , text:'Down' ,properties:{scrolling:undefined,multiline:undefined}},"+

"across:DropDownList{bounds:[10,30,100,50]},"+

"down:DropDownList{bounds:[140,30,230,50]},"+

"saveFiles:Checkbox{bounds:[10,60,230,80] , text:'Save and Close new files?'}},"+

"button0:Button{bounds:[10,140,110,160] , text:'Ok' },"+

"button1:Button{bounds:[150,140,250,160] , text:'Cancel' }}};"

var win = new Window(dlg,'File Chop');

if(version.substr(0,version.indexOf('.'))>9){

win.panel0.title.graphics.font = ScriptUI.newFont("Georgia","BOLD",20);

g = win.graphics;

var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [1.00, 1.00, 1.00, 1]);

g.backgroundColor = myBrush;

var myPen =g.newPen (g.PenType.SOLID_COLOR, [1.00, 0.00, 0.00, 1],lineWidth=1);

}

win.center();

for(var i=1;i<31;i++){

win.panel0.panel1.across.add ('item', i);

win.panel0.panel1.down.add ('item', i);

}

win.panel0.panel1.across.selection=0;

win.panel0.panel1.down.selection=0;

var done = false;

while (!done) {

var x = win.show();

if (x == 0 || x == 2) {

win.canceled = true;

done = true;

} else if (x == 1) {

done = true;

{

if(!documents.length)return;

var startRulerUnits = preferences.rulerUnits;

preferences.rulerUnits = Units.PIXELS;

doc = app.activeDocument;

app.displayDialogs = DialogModes.NO;

doc.flatten();

var tilesAcross = parseInt(win.panel0.panel1.across.selection.index)+1;

var tilesDown =parseInt(win.panel0.panel1.down.selection.index)+1;

var tileWidth = parseInt(doc.width/tilesAcross);

var tileHeight = parseInt(doc.height/tilesDown);

var SaveFiles = win.panel0.panel1.saveFiles.value;

ProcessFiles(tilesDown,tilesAcross,tileWidth,tileHeight,SaveFiles);

app.preferences.rulerUnits = startRulerUnits;

}

}

}

}

main();

function ProcessFiles(Down,Across,offsetX,offsetY,SaveFiles){

try{

var newName = activeDocument.name.match(/(.*)\.[^\.]+$/)[1];

}catch(e){var newName="UntitledChop"}

var Path='';

try{

Path = activeDocument.path;

}catch(e){Path = "~/Desktop";}

if(SaveFiles){

Path = Folder(decodeURI(Path) +"/FileChop");

if(!Path.exists) Path.create();

}

TLX = 0; TLY = 0; TRX = offsetX; TRY = 0;

BRX = offsetX; BRY = offsetY; BLX = 0; BLY = offsetY;

for(var a = 0; a < Down; a++){

for(var i = 0;i

var NewFileName = newName +"#"+a+"-"+i;

app.activeDocument.duplicate (NewFileName, true);

activeDocument.selection.select([[TLX,TLY],[TRX,TRY],[BRX,BRY],[BLX,BLY]], SelectionType.REPLACE, 0, false);

executeAction(charIDToTypeID("Crop"), undefined, DialogModes.NO);

app.activeDocument.selection.deselect();

if(SaveFiles){

var saveFile = File(decodeURI(Path+"/"+NewFileName+".tiff"));

SaveTIFF(saveFile);

app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

}

activeDocument = documents[0];

TLX = offsetX * (i+1) ; TRX = TLX + offsetX; BRX = TRX; BLX = TLX;

}

TLX = 0; TLY = offsetY * (a +1); TRX = offsetX; TRY = offsetY * (a +1);

BRX = offsetX; BRY = TRY + offsetY; BLX = 0; BLY = (offsetY * (a +1)+offsetY);

}

if(SaveFiles){

Path.execute()

}

}

function SaveTIFF(saveFile){

tiffSaveOptions = new TiffSaveOptions();

tiffSaveOptions.embedColorProfile = true;

tiffSaveOptions.alphaChannels = true;

tiffSaveOptions.layers = true;

tiffSaveOptions.imageCompression = TIFFEncoding.NONE;

activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);

}

ps中怎么导出tif_用Photoshop自动切割大型TIFF文件并将切片保存到TIFF文件中?相关推荐

  1. android把音乐存到sd卡上,如何将音乐文件从原始文件夹保存到SD卡中android

    嗨,我需要将音乐文件保存到SD卡我试过使用下面的代码只有文件夹在SD卡中创建的文件夹没有音乐文件保存任何一个建议我在哪里我做了错误...如何将音乐文件从原始文件夹保存到SD卡中android Fill ...

  2. Word: 是否将更改保存到WordCmds.dot中?

    是否将更改保存到WordCmds.dot中? 1.问题描述 关闭Word会弹出"是否将更改保存到WordCmds.dot中?"提示,无论是点保存,还是不保存,下次关闭Word的时候 ...

  3. 实现从淘宝(天猫)定时抓取订单数据、打印电子面单并保存到ERP表中

    实现从淘宝(天猫)定时抓取订单数据.打印电子面单并保存到ERP表中 前言 实现思路 代码片段参考 前言 最近有厂商提出想把天猫店铺的数据拿到后台ERP管理系统中,并能实现线下打印电子面单功能.接手这个 ...

  4. TF学习——TF数据读取:TensorFlow中数据读这三张图片的5个epoch +把读取的结果重新存到read 文件夹中

    TF学习--TF数据读取:TensorFlow中数据读这三张图片的5个epoch +把读取的结果重新存到read 文件夹中 目录 实验展示 代码实现 实验展示 代码实现 1.如果设置shuffle为T ...

  5. Crawler:基于BeautifulSoup库+requests库+伪装浏览器的方式实现爬取14年所有的福彩网页的福彩3D相关信息,并将其保存到Excel表格中

    Crawler:Python爬取14年所有的福彩信息,利用requests库和BeautifulSoup模块来抓取中彩网页福彩3D相关的信息,并将其保存到Excel表格中 目录 输出结果 核心代码 输 ...

  6. Pandas的学习(读取mongodb数据库集合到DataFrame,将DataFrame类型数据保存到mongodb数据库中)

    1.读取mongodb数据库集合到DataFrame import pymongo import pandas as pdclient = pymongo.MongoClient("数据库连 ...

  7. C++读取txt数据为二维数组 将数据保存到txt文本中

      C++读取txt数据为二维数组 保存txt文本数据     C++文件读写操作有:ofstream,ifstream,fstream: #include <fstream> ofstr ...

  8. session mysql java_PHP自定义session处理方法,保存到MySQL数据库中

    我们都知道,session是为了解决因特网的无状态属性而创造出来的.我们可以用session这种会话管理机制来构建购物车.监控站点网络访问,甚至还可以跟踪某一个用户具体是如何使用你的应用的.PHP默认 ...

  9. python3 xlsxwiter模块插入matplotlib保存到io.BytesIO中的图

    python3 xlsxwiter模块插入matplotlib保存到io.BytesIO中的图 解决问题 代码示例 生成的Excel文件结果 解决问题 1.xlsxwriter生成excel文件的基础 ...

最新文章

  1. golang多语言支持
  2. tensorflow省钱方案-ml-engine
  3. dubbo web工程示例_带有Dubbo的Spring Cloud Alibaba
  4. [译] Android 的多摄像头支持
  5. leetcode142. 环形链表 II(暴力+双链表)
  6. leetcode253. 会议室 II
  7. law是什么的缩写_Lawyer和Attorney 有什么不同?
  8. Spring启动的流程
  9. POJ 1472 Instant Complexity
  10. 用protobuf进行C#与Java通信
  11. 14行代码教你制作自己的有道词典单词本(python)
  12. 酷狗歌词Krc批量转换工具Lrc [附转换编码DLL]
  13. Maven镜像(mirror)
  14. linux网卡驱动重新安装,LINUX网卡驱动重新安装
  15. 信息安全意识主题分享-数据安全
  16. 信通方恒资产评估快讯 -《中国矿业》矿业综述 - 2021年国内外油气资源形势分析及展望
  17. 9个offer,12家公司,35场面试,计算机应届毕业生求职之路
  18. 图表可视化配色学习——自动提取图片主色调与配色方案(python、pillow、haishoku和seaborn),并生成十六进制颜色编码
  19. 信息学奥赛一本通:1135:配对碱基链
  20. 未来的计算机能帮人类炒股,未来计算机能帮人类炒股吗

热门文章

  1. 齐岳|聚乙二醇-四氧化三铁-二氢卟吩纳米复合物Fe3O4-PEG-Ce6|肝靶向功能的四氧化三铁Fe3O4纳米粒子
  2. Ubuntu16.04下使用kalibr标定intel RealSense D435i imu+双目
  3. 破解excel格式保护
  4. P3396 哈希冲突 (根号算法)
  5. powerquery分组_Power Query 神奇的分组统计1
  6. 经典卷积神经网络-AlexNet
  7. 同余及其性质(Congruence)
  8. 用python语言绘制美丽图形
  9. day57 闭包函数 函数提升 BOM操作 js选择器 替换元素 类属性操作
  10. 福利:工作经常用到的Mac软件整理(全)