Copy link to clipboard
Copied
Hello, my name is Carl. I have a question for you and i hope you can help me. The thing is that I have a super 8 film movie that i wanted to digitize, looking on the web I found this guide that helped me a lot and I decided to try out.
http://keneckert.com/kenfilms/telecine/index.html
I have scanned the film and i have used the script in the guide to straighten the pictures just like the guide, the problem now is that I don't know how to crop each frame from the image, i tried using the script but it doesn't work for me since the only thing that does is to create a selection that i have to manually put over each frame every time i need to crop, and since the film is over 3000 frames it would be very dificult to do it.
Because of that, I would like to know if there is a better way to do it or if you could tell me how to solve this issue.
Best regards.
You could see if the following script works for you, it was not designed specifically for the task at hand, but it may just work if the frames are evenly spaced/divisible into the canvas width. You would enter say 3000 for the number of columns and 1 for the number of rows. That being said, I would crop down a copy to have only save 10 or 20 frames and then test on the copy first. If this does work for you, it is easy enough to add an extra line of code to automatically rotate the final crops if
...Copy link to clipboard
Copied
Can you provide an original resolution crop from the scan, starting from the original upper left position of the scan and say including 3 or 5 frames? If too large to attach to your reply, you can use your CC account to share a link to the file, or a file-sharing service such as DropBox, WeTransfer etc.
Copy link to clipboard
Copied
You could see if the following script works for you, it was not designed specifically for the task at hand, but it may just work if the frames are evenly spaced/divisible into the canvas width. You would enter say 3000 for the number of columns and 1 for the number of rows. That being said, I would crop down a copy to have only save 10 or 20 frames and then test on the copy first. If this does work for you, it is easy enough to add an extra line of code to automatically rotate the final crops if required.
//community.adobe.com/t5/photoshop/dividing-big-document-to-smaller-ones/m-p/9311087
// split image into x times y segments and save them as psds;
// 2017, use it at your own risk;
// 2020 - Modified by Stephen Marsh, adding prompts, save alert, saved doc test.
#target photoshop
/* Start Unsaved Document Error Check - Part A: Try */
unSaved();
function unSaved() {
try {
activeDocument.path;
/* Finish Unsaved Document Error Check - Part A: Try */
/* Main Code Start */
if (app.documents.length > 0) {
var originalUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// document;
var myDocument = app.activeDocument;
var theName = myDocument.name.match(/(.*)\.[^\.]+$/)[1];
var thePath = myDocument.path;
var theCopy = myDocument.duplicate("copy", false);
// Original X input
var theXinput = prompt("Enter the number of columns across:", 2);
// Remove anything that is not a digit or full point
var theXinputCleaner = theXinput.replace(/[^\d\.]/, '');
// Convert to integer
var theXtoInteger = parseInt(theXinputCleaner, 10);
// Final result
var theX = theXtoInteger;
// Original Y input
var theYinput = prompt("Enter the number of rows down:", 2);
// Remove anything that is not a digit or full point
var theYinputCleaner = theYinput.replace(/[^\d\.]/, '');
// Convert to integer
var theYtoInteger = parseInt(theYinputCleaner, 10);
// Final result
var theY = theYtoInteger;
// Canvas Division
var xFrac = myDocument.width / theX;
var yFrac = myDocument.height / theY;
// psd options;
psdOpts = new PhotoshopSaveOptions();
psdOpts.embedColorProfile = true;
psdOpts.alphaChannels = true;
psdOpts.layers = true;
psdOpts.spotColors = true;
// create folder;
var folderName = thePath + "/" + theName + "_" + theX + "x" + theY;
if (Folder(folderName).exists == false) {
Folder(folderName).create()
};
//save jpgs;
for (var n = 1; n <= theY; n++) {
for (var m = 1; m <= theX; m++) {
cropTo((m - 1) * xFrac, (n - 1) * yFrac, m * xFrac, n * yFrac);
var theNewName = theName + "_" + bufferNumberWithZeros(m, 3) + "_" + bufferNumberWithZeros(n, 3);
theCopy.saveAs((new File(folderName + "/" + "_" + theNewName + ".psd")), psdOpts, true);
theCopy.activeHistoryState = theCopy.historyStates[0];
}
};
theCopy.close(SaveOptions.DONOTSAVECHANGES);
// reset;
app.preferences.rulerUnits = originalUnits;
};
////// buffer number with zeros //////
function bufferNumberWithZeros(number, places) {
var theNumberString = String(number);
for (var o = 0; o < (places - String(number).length); o++) {
theNumberString = String("0" + theNumberString)
};
return theNumberString
};
////// crop //////
function cropTo(x1, y1, x2, y2) {
// =======================================================
var desc7 = new ActionDescriptor();
var desc8 = new ActionDescriptor();
var idPxl = charIDToTypeID("#Pxl");
desc8.putUnitDouble(charIDToTypeID("Top "), idPxl, y1);
desc8.putUnitDouble(charIDToTypeID("Left"), idPxl, x1);
desc8.putUnitDouble(charIDToTypeID("Btom"), idPxl, y2);
desc8.putUnitDouble(charIDToTypeID("Rght"), idPxl, x2);
var idRctn = charIDToTypeID("Rctn");
desc7.putObject(charIDToTypeID("T "), idRctn, desc8);
desc7.putUnitDouble(charIDToTypeID("Angl"), charIDToTypeID("#Ang"), 0.000000);
desc7.putBoolean(charIDToTypeID("Dlt "), false);
desc7.putEnumerated(stringIDToTypeID("cropAspectRatioModeKey"), stringIDToTypeID("cropAspectRatioModeClass"), stringIDToTypeID("pureAspectRatio"));
desc7.putBoolean(charIDToTypeID("CnsP"), false);
executeAction(charIDToTypeID("Crop"), desc7, DialogModes.NO);
};
alert('PSD Files saved to: ' + folderName);
/* Main Code Finish */
/* Start Unsaved Document Error Check - Part B: Catch */
} catch (err) {
alert('An image must be both open and saved before running this script!')
}
}
/* Finish Unsaved Document Error Check - Part B : Catch */
LAST EDITED: 15th May 2020 – Refined the code for the prompts
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
Hi, following up on this with a slightly related query.
My goal: to give photoshop raw scan files of 35mm film strips and have photoshop divide, separate and save the photos in to individual files. I always scan at 5 columns by 2 rows.
This script you've shared is doing a fanstastic job at splitting my photos, but requires my input. This user input removes automation as I am hoping to apply this script to multiple scan files at once. I need your help with this since I'm not a programmer, how do I edit this script so it knows to divide the images 5x2?
Thank you for your help!
Copy link to clipboard
Copied
I modified the original code to be interactive, however, I referenced the original script in the comment at the head of the code, so it is easier to just point you back to the original source of the code that uses static values which would be more applicable for unattended batch processing:
https://community.adobe.com/t5/photoshop/dividing-big-document-to-smaller-ones/td-p/9311087?page=1
Copy the 67 lines of code marked as the correct answer (thanks to c_pfaffenbichler). Copy from the lines starting with the // double forward slash comment, down to the final };
Then change lines 14 and 15
from:
var theX = 2;
var theY = 2;
to:
var theX = 5;
var theY = 2;
or vice/versa and you should be good to go!
Copy link to clipboard
Copied
Fabulous, this works exactly as needed. Thank you!
Copy link to clipboard
Copied
Hi, I have a similar request. I have 35mm film strips of 6 frames each. What will my variable be set to? I tried running the script with the following and didn't have any success:
var theX = 5;
var theY = 2;
Another question is, where does the script save the final output files?
Thanks!
Copy link to clipboard
Copied
Nevermind! Was able to figure both of my issues out! Works great, thanks! Is there any way to export the files as jpgs and not psd's?
Copy link to clipboard
Copied
Is the only requirement to crop every image the same way?
Is there any other processing that needs to be done, like stabilizing jitter?
And each individual frame is a separate still image file?
[I deleted the rest of my own post because it was barking up the wrong tree 🙂 ]
Copy link to clipboard
Copied
Hi Conrad, If I understand the OP, it's a single filmstrip of over 3000 image frames, I believe similar to:
Copy link to clipboard
Copied
Hi Stephen, yes that is correct, sorry if i wasn't very clear or specific about what i need to do, this is the first time i'm doing this with super 8 film, furthermore, english is not my first language.
I will upload a sample of the image that the scanner made and one example of a frame of the film that i need to extract from each image strip in order to make a video.
Copy link to clipboard
Copied
I hard for me to believe the you have a single scan that contains 3000 super 8mm frames. I would think the you would have many scans of super 8mm film strips that contains some number of frames that have been straighten via a Photoshop.
I wrote a script to do that a while back for some user here. However, my script required the user to manually set two color sample points before running the script so it would be able to straighten a single strip. Extracting the frames contents was not addressed. could I use two magic wand selections to straighten an image
If a scanned strip is perfectly straightened you may be able to perfectly select all the frames content in the strip and crop. So all you will have is a image strip. No borders no sprocket holes. If you can do that you should be able to dice that image strip with an Action that uses a script I posted a while back
how to slice a very large poster.
You would still have to crop each film strip manually and run the action which has an interactive step where you set the guide line grid the number of rows and columns. In your Image strip either a single row or column and some number of Frame. If all your strips have the same number of frames. You can rerecord the interactive step. Set the row or column to one and the other to the number of frames in the image strip. Remove the check mark from the step dialog box. Then the action will be fully automatic
Copy link to clipboard
Copied
Hello, yes, probably it is the same person that i mentioned in the link that i posted. I actually used the same script in order to straighten the images as you mention, which was relatively easy, the next step would be to extract each frame in order to make a movie, but i cannot find a propper way to do it fast or without being so time consuming.
Copy link to clipboard
Copied
Did you try to dice a strip up using the information in the link I posted? The action using a script...?
It look like it would work to me I just cropped your strip and set the guides
If all your film strips have 16 frames you can set your rectangle marquee tool to a fixed size for the 16 frames. make that selection and position it around the frame then crop. when you dice the up withe the action all frames will be the same size.
Copy link to clipboard
Copied
Thanks for the help, I have seen that you are the same person that helped the guy in the first link i posted, I have tried the method you mention and it the thing that worked for me was the script that straightens the image using the color sampler inside the sprocket hole. It is true that each image contains 16 frames, however the problem is that the method that i used to scan was not perfect and there are sections of previous frames in the top and at the bottom of the image so because of this if i used the guides it would take me a lot of time since i would have to manually adjust the guides so that they fit properly in each frame. I think that a method using the sproket holes to find the correct size and to crop it would work but i don't know how to do it.
Copy link to clipboard
Copied
So, you have multiple strips of 16 up frames?
The attached animation is the result of the script that I previously posted, using a column of 1 and rows of 16 as the input.
The image jumps around a lot as the total canvas size was not evenly divisible by 16.
Perhaps another method that used the sprocket hole to base the crop on would be better. Video is not my area, I keep thinking that there must be better, dedicated tools for this.
Copy link to clipboard
Copied
Thank you for the help, I tested this with a couple other images but it would not work because the frames on the scanned image sometimes are in different position and the result of the script are frames cut in half or not complete frames shown. As you mention, the best method seems to be something based on the sprocket hole but I cannot figure it out how to do it in a more automatic way, I could just use marquee tool to select each frame but it would take me forever since i have over 300 scanned images each containing a film strip of 16 frames.
Copy link to clipboard
Copied
If you are going automate the extraction of the frame you will need automated it with a process like you used to straighten your film stripe with a script. A user assisted process an interactive process. You would need to set an active rectangle selection around the 16 frames in the strip. One set you can have a script for the rest of the extraction process. Since all you strips have 16 full frames an action could set the correct size selection and put you in control to drag the select to the proper location where press enter. The action continues to play, it crops to the selection and runs a script to cut out the frames.
To automate the whole process would require you to program a content aware AI process that would extract the frames. You would also include the straighten process in you AI plug-in. The AI process would straighten, Crop to the full frames the dice out the frames
Copy link to clipboard
Copied
Did you ever figure out how to record an action to extract your supper 8mm film scans. The results are not the best but it hard to know for sure. The scan quality was poor and there was some camera movement so hard to tell if the selection I set was the correct height for 16 8mm frames. If the height is wrong the 16 cut frames would not have the correct frame height which is critical. The width being off would just be like cropping the frame sides. The wrong height would cause image drift. The Action cropped the film strip diced the stripe into frame layers and exported the layers as files. Create a frame animation and renders an MP4. I did have to make the Export layers to files step a script step. Export Layers to Files is a plug-in so it can be recorded in an action however, the file prefix would also be the same when played not reflect the current strip's file name. I did not want two interactive steps in the action so the script set the file prefix to the current strip's name. I also found a had to zoom to actual pixels to be able to position the transform selection well. You cab see the in the screen capture.
Copy link to clipboard
Copied
Hello JJMack, thank you for your help. Unfortunately I have been very bussy at work, and I couldn't find a proper way to deal with this project at the moment. I believe that it is important to tell you that I am not a professional and the only reason to do this project was to have a copy of the only super 8 film video that I have. It was recorded by my parents around the 70's, so I wanted to recover that film and convert it to digital so everyone in my family can have it. I have more experience dealing with scanning 35mm photo negatives, and to do simple enhancements, so I tried to give it a chance and try to replicate what I saw in the page that I posted at the begining .
Having said that, I think that the final result that you were able get was fantastic. I would like to replicate what you did but I don't understand how to do it. Could you guide me or tell me the steps I need to follow so that I can do the same as you did?
Copy link to clipboard
Copied
Note the transform selection is interactive I checked that step dialog on you need to manually position the active selection around the frames move the top left corner so it is aligned to the first frame top left.
Script that exports layers to files into desktop\cutframes.
var exportFolder = "~/Desktop/cutframes";
var makeFolder = new Folder(exportFolder);
makeFolder.create();
expportFrames(exportFolder, activeDocument.name);
function expportFrames(saveTo, preFix) {
// Export Layers to Files
var desc1 = new ActionDescriptor();
desc1.putString(app.charIDToTypeID('Msge'), "Export Layers To Files action settings");
desc1.putString(app.stringIDToTypeID("destination"), saveTo);
desc1.putString(app.stringIDToTypeID("fileNamePrefix"), preFix);
desc1.putBoolean(app.stringIDToTypeID("visibleOnly"), false);
desc1.putDouble(app.charIDToTypeID('FlTy'), 1);
desc1.putBoolean(app.stringIDToTypeID("icc"), true);
desc1.putString(app.stringIDToTypeID("jpegQuality"), "10");
desc1.putBoolean(app.stringIDToTypeID("psdMaxComp"), true);
desc1.putString(app.stringIDToTypeID("tiffCompression"), "TIFFEncoding.NONE");
desc1.putString(app.stringIDToTypeID("tiffJpegQuality"), "8");
desc1.putString(app.stringIDToTypeID("pdfEncoding"), "PDFEncoding.JPEG");
desc1.putString(app.stringIDToTypeID("pdfJpegQuality"), "8");
desc1.putString(app.stringIDToTypeID("targaDepth"), "TargaBitsPerPixels.TWENTYFOUR");
desc1.putString(app.stringIDToTypeID("bmpDepth"), "BMPDepthType.TWENTYFOUR");
desc1.putBoolean(app.stringIDToTypeID("png24Transparency"), true);
desc1.putBoolean(app.stringIDToTypeID("png24Interlaced"), false);
desc1.putBoolean(app.stringIDToTypeID("png24Trim"), false);
desc1.putBoolean(app.stringIDToTypeID("png8Transparency"), true);
desc1.putBoolean(app.stringIDToTypeID("png8Interlaced"), false);
desc1.putBoolean(app.stringIDToTypeID("png8Trim"), true);
executeAction(app.stringIDToTypeID('6f1c2cf5-4a97-4e32-8f59-f5d7a087adef'), desc1, DialogModes.NO);
};
Copy link to clipboard
Copied
@JJMAck, @Stephen Marsh , is there a copy somewhere of all the sctipts you guys ever created?
I've seen that Paul's scripts are in a github, not sure if it is too technical, there is Ps Scripts, but I am thinking something simple for the user, with description of what does what, so much work put into this, beyond the understanding of most (If I can generalize my case)
It would need to be written so that the version it was made for would be clearly stated... I'm really sad that the Adobe Exchange seems too complicated to manage and install.
The load scripts panel of InDesign seems a good starting point, it should point to a simple repository.
Copy link to clipboard
Copied
I gave up on Adobe exchange over the years Adobe changed how things worked a and was very slow to post users updated and fixes and not is so complex you have to jump through hoops to package a simple thing like a script or action file. So it will be installed the adobe way via the creative cloud desktop application. So years ago I just put packages I made available on my old web site the I do maintain any more. I just leave it as is but I do keep the package I use updated. Some of the stuff there us old and not the greatest. Like the Photoshop Web Photo Galleries generating scripts create Flash Photo I never had problem With Flash based Photo Galleries. Here is the link. JJMacks Free downloads. The first few packages are not bad some may find them o use: Place Watermak Package, Cycle Tool Presets Package, Crafting Actions Package, Photo Collage and Mockup Toolkit. The stuff after those are old and dated. May be useful to look at if you trying to learn Photoshop to see how I approach PS in the PS7 and CS time frame. I started hacking scripts in CS2. That taught me a lot about Photoshop. I was scripting my Photo College tool and using Place. Things went haywire. It took me months to figure out how Adobe implemented Place. IMO place has a big issue. Place is noe like Duplicate document or late and copy plate the preserve your Image quality. Place may degrade you images if your not careful. If you save Print images and edits documents with different print resolution. You need to be careful if you use Place to place these images into document you are editing. Place is very likely to degrade your images creating the smart objects for the layers.
Copy link to clipboard
Copied
roxon wrote: “I could just use marquee tool to select each frame but it would take me forever ”
Yes, the rectangular marquee is clumsy and difficult to work with, for the trial and error needed to work out the correct size and offset of the crop frame. Although it’s easy to resize and reposition a rectangular marquee using Select > Transform Selection, creating a new layer (for each frame) from a selection would drop the selection. I decided to try a different approach based on using a rectangular path (not a shape layer). A vector path is easy to save, easy to adjust, and easy to create a selection from. Using this path-based approach, trial and error goes much faster, and I was able to get the core of an action down to 6 steps.
This is how it works:
The action does the following:
After all frames are done, simply use Layer > Export As to export all layers as separate image files.
Looks like I could have cropped out a little more of the sprocket hole on the left. That would easily be done by moving the left edge of the vector path rectangle to the right by a few pixels.
There are still areas of this that could be improved by scripting, such as putting leading zeros into the layer/file names so that the frames sort properly by name, and maybe have a way to detect the end of the filmstrip so that the action could automatically run itself and stop itself. But I’m not good at scripting.
I’m going to remove my earlier demo (ACR-based), because it didn’t contribute to the discussion.
Copy link to clipboard
Copied
I have a question regarding 8mm Cine film frames.
I build a machine to photograph each frame from a Cine film, Standard 8mm (one with sprocket holes near the top left and bottom left corner) and Super 8mm (which has the sprocket hole in the centre on the left-hand side.
My problem is that in both cases, each frame is slightly out of alignment. I enclose examples of both and as you will notice, each frame is slightly up or down.
Although Standard 8 and Super 8 frames vary in size, the relative position to their own sprocket hole is the same.
Now I can manually "crop & save" each frame, but this would take a long time.
Would it be possible with the help of a script, to crop the frame, relative to the sprocket position?
I tried the script attached below, (thanks to ken Eckert (who raised the initial call), but this seems "crop & cut" in a fixed place.
---------------
#target photoshop
if (documents.length == 0) {
alert("nothing opened");
} else {
// start
//setup
var file = app.activeDocument;
var selec = file.selection;
//run
var bnds = selec.bounds; // get the bounds of current selection
var // save the particular pixel values
xLeft = bnds[0],
yTop = bnds[1],
xRight = bnds[2],
yBottom = bnds[3];
// Regular 8
var newRect = [ [xLeft-180,yTop +70], [xLeft-180,yTop+870], [xLeft + 1350,yTop + 870], [xLeft + 1350,yTop +70] ];
// Super 8
//var newRect = [ [xLeft -95,yTop -1050], [xLeft -95,yTop+1625], [xLeft + 3725,yTop + 1625], [xLeft + 3725,yTop - 1050] ]; // set coords for selection, counter-clockwise
selec.deselect;
selec.select(newRect);
// end
}
------------------