Ich versuche, Bilder innerhalb und Bild ausschneiden.Crop mehrere Bilder von innen und Bild
Technisch sind es Buchstaben, Buchstaben und Zahlen. Die Breite ist 504 und die Höhe ist 1008. Ich denke jedes Zeichen ist ein Block von 24x24 Pixel.
Ich habe mich für eine Weile versucht, aber ich kann das Cropping nicht herausfinden. Ich bin nicht soweit gekommen, dass ich den gesamten Prozess dafür automatisieren konnte.
Hier ist mein Skript, wie es jetzt ist.
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);
};