Copy link to clipboard
Copied
Hi !
I have images of comics, which I want to make less heavy. The comic is one single column of images which reads from top to bottom, and the images have a ton of white space between them. It makes each image file unnecessarily tall. But I have hundreds of such "pages" so it's unthinkable for me to go through each one, and manually move the images closer together.
I was wondering if there was maybe a plugin or a function I'm not aware of, that could automate the process ? I know it's very specific.
Thank you for your help !
Copy link to clipboard
Copied
Are each of the squares and spacing of the comics the same size?
Copy link to clipboard
Copied
Also how is the file structure: flat- one layer, many layers, or many layer in layersets for each frame?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Are each of the files consistent? can you post an example?
Copy link to clipboard
Copied
Some sample images would be helpful. You may be able to use the magic wand ins contiguous mode to select the white borders and clear then the use script to split the comic cell into layers. Split to layers Once you have the layers you could export the layers to files and trim the transparency or write a script to align the layers in the stack to the bounds of the layer above one and other. Then trim the documents transparency.
Copy link to clipboard
Copied
Okay, I think I came up with a way to do this. It's using the crop and straighten function. So if your frames all have a border around them, this should work. Attahced is a sample of the file before and the resulting file after. Right now the script closes the main file and leaves the resulting file open, a save function can be added, depending on what type of file you want to save and where. It might be able to be batched - haven't tried that yet. Just see if it works on one file first. Oh, and you can change the margin size by editing the margin variable in the script. Right now it's set for 20 px.
#target photoshop
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var dName = doc.name.split('.')[0];
var dRes = doc.resolution
var margin = 20
cropS ();
doc.close(SaveOptions.DONOTSAVECHANGES);
var dNum = app.documents.length;
var doc1 = app.documents[0];
var newHeight = margin * (dNum +1) + doc1.height.value * dNum;
makeNewFile (doc1.width.value + margin*2, newHeight, dRes);
var targetDoc = activeDocument;
var transHeight = margin
for(var i=0;i<dNum;i++){
var curDoc = activeDocument = app.documents[0];
var curHeight = curDoc.height.value;
curDoc.layers[0].duplicate (targetDoc.layers[0], ElementPlacement.PLACEBEFORE);
curDoc.close(SaveOptions.DONOTSAVECHANGES);
activeDocument = targetDoc;
var mLayer = targetDoc.layers[0];
mLayer.translate (margin - mLayer.bounds[0].value, transHeight - mLayer.bounds[1].value);
transHeight += margin + curHeight;
}
targetDoc.flatten();
function cropS (){
var idCropPhotosAutozerozerozeroone = stringIDToTypeID( "CropPhotosAuto0001" );
executeAction( idCropPhotosAutozerozerozeroone, undefined, DialogModes.NO );
}
function makeNewFile (w,h,res){
app.documents.add(w,h,res,dName,NewDocumentMode.RGB)
}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now