2017-03-17 1383 views
-1

我有一个TIFF文件。我想自动切片(指定水平和垂直切片的数量)并将它们保存到TIFF文件中(我不想将格式更改为PNG或...)用Photoshop自动切割大型TIFF文件并将切片保存到TIFF文件中?

我知道你可以选择切片工具>>右键>>分割切片>>保存为网络

但“Save for web”不提供TIFF格式保存,也不认为它可以用于大文件。

任何可以帮助(脚本,插件)是值得欢迎的

+0

您可以将切片转换为图层(然后保存为tiff)[请参阅SU问题](https://superuser.com/questions/425811/is-it-possible-in-photoshop-to-convert-slices-into -photoshop-layers) –

+0

@MrMysteryGuest谢谢,我会试试看。 –

+0

@MrMysteryGuest请参阅下面的答案。我依赖于直接保存到Tiff文件的方式,而不是那种方式。 –

回答

0

根据网上资源,并与一些编码,下面的脚本能够自动切一个大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 <Across; 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); 
}