• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Cropping and saving incremental filenames

Participant ,
Nov 24, 2014 Nov 24, 2014

Copy link to clipboard

Copied

I am inexperienced at scripting but a long-time Ps user.  I'm exploring the feasibility of converting deteriorating motion picture film to an image sequence using a flatbed scanner.  Assuming that I can rig a template to scan multiple scripts of film in a consistent position (much like a contact sheet) I'd like to then crop and export each frame incrementally. 

Any suggestions on where to begin?  I'm thinking that I will first need a list of coordinates for each frame (might be 100 frames per scan) then crop and save with incremental numbering.  Or should I build masks for each frame and write a routine to discard the mask area from the canvas?

TOPICS
Actions and scripting

Views

313

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Enthusiast ,
Nov 24, 2014 Nov 24, 2014

Copy link to clipboard

Copied

I don't really know, but sounds cool so have to say something

One issue is frame order, will your first scan provide frames 1-10, 11-20, 21-30... or 1-10, 372-381, 748-757... I.e. will you be cutting strips or moving them? To process them to a "stack" you need to have a handle on this. One option is to use very large numbering for each strip like 1-10000, 10001-20000, etc. So the aim would be to get frames 00001-00371 from first strip, then 10000-10371, etc. It's not sequential, but correctly ordered.

Bigger issue is likely accuracy, i.e. how much jitter is there in each position and if there is rotation. Would be good if vertical is stable as the space between frames is constant so moving to next frame should be easy. I.e. you need to find beginning of first frame of strip and then start copying. A very simple solution would be to manually select first frame and then let script continue to scrape the rest of strip. Or if you can crop a bit, capture a bit smaller frames so you can easily hit to each. In any case I'd start with something easy, run shake removal algorithm in video editing and see what you get.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Nov 24, 2014 Nov 24, 2014

Copy link to clipboard

Copied

Thanks, Matias.  Yes, I'm sure I would need 5 digit numbering.

I'm actually planning to overscan the frames and use Pr to reduce the shake.  It does a great job with camera vibration so why not variances in frame position.  And yes, I am planning on cutting the film into strips, since it is falling apart anyway. 

Is there a script command or a keyboard equivalent to drawing a rectangular selection with a specific size and location?  I know I can view the location but I can't figure out how to adjust the location and size.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Nov 24, 2014 Nov 24, 2014

Copy link to clipboard

Copied

LATEST

Yes, (in Javascript API) there is the collection document.selection that offers methods for manipulating the selection. I had these functions in my library that you can use as an example

isAreaEmpty: function (left, top, right, bottom) {

  var selection_area = new Array(new Array(left, top), new Array(right, top), new Array(right, bottom), new Array(left, bottom))

  var selection = app.activeDocument.selection

  selection.select(selection_area)

  try {

  selection.copy()

  } catch (e) {

  return true

  } finally {

  selection.deselect()

  }

  return false

},

clearArea: function (left, top, right, bottom) {

  var selection_area = new Array(new Array(left, top), new Array(right, top), new Array(right, bottom), new Array(left, bottom))

  var selection = app.activeDocument.selection

  selection.select (selection_area)

  selection.clear()

  selection.deselect()

},

deselect: function () {

  app.activeDocument.selection.deselect()

},

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines