0
我正在尝试裁剪图像内部和图像。从内部和图像中裁剪几张图片
技术上它是字符,字母和数字。
宽度是504,高度是1008.我认为每个字符是一个24x24像素的块。
我一直在尝试自己一段时间,但我无法弄清楚裁剪。 我还没有得到能够自动完成整个过程的原因。
这是我的脚本,因为它是现在。
hlineMinus = 0;
//for (var i = 0; i < 21; i++) {
var doc = app.activeDocument;
imageWidth = activeDocument.width.as('px');
imageHeight = activeDocument.height.as('px');
imageWidth - 24;
imageHeight - 24;
hline = i+1 * 24;
hlineMinus = 0;
if(hline = 21*24)
hlineMinus += hline;
hline=hlineMinus;
var bounds = [24*(i), 0, 24*(i+1), 24*(i+1)];
doc.crop(bounds);
//do the math to figure out how big you want it after resize
//doc.resizeImage(newWidth, newHeight);
//note this is saving over the original!!!!
var opts, file;
opts = new ExportOptionsSaveForWeb();
opts.format = SaveDocumentType.PNG;
opts.PNG8 = false;
opts.quality = 100;
var d = i;
pngFile = new File(doc.path + d + doc.name);
app.activeDocument.exportDocument(pngFile, ExportType.SAVEFORWEB, opts);
//app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
//stepHistoryBack();
//}
function stepHistoryBack(){
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("HstS"), charIDToTypeID("Ordn"), charIDToTypeID("Prvs"));
desc.putReference(charIDToTypeID("null"), ref);
executeAction(charIDToTypeID("slct"), desc, DialogModes.NO);
};