8 Replies Latest reply on Feb 15, 2018 1:52 AM by Tom Winkelmann

# How can I Expand Magic Wand Selection by Predetermined x, y?

Hello all

I am scanning movie film on a film scanner and have several thousand image files of vertical strips of movie film, each with 13 frames, straightened.

In all of them the sprocket hole is almost in the same place, about +/- 20 pixels.

I'd like to have a script where I could select the sprocket hole with the magic wand, press a function key (or similar) and the selection would grow by 400 pixels upward, 400 pixels downward, and 1200 pixels rightward (let's say). Then I could crop and have individual image files for each movie frame where the sprocket is always in the exact same place.

There is a generic "grow" command, but it doesn't let me control directions or x/y separately.

Example: http://keneckert.com/temp/x.jpg

Thanks all.

• ###### 1. Re: How can I Expand Magic Wand Selection by Predetermined x, y?

```app.preferences.rulerUnits = Units.PIXELS;

var up    = 400;
var down  = 400;
var right = 1200;

var doc = app.activeDocument;

var x = (doc.selection.bounds[2]+doc.selection.bounds[0])/2;
var y = (doc.selection.bounds[3]+doc.selection.bounds[1])/2;

doc.selection.select([[x, y-up],[x+right, y-up],[x+right, y+down],[x, y+down]], SelectionType.REPLACE);
```
• ###### 2. Re: How can I Expand Magic Wand Selection by Predetermined x, y?

If that example is an actual scan is it even worth wild?  The film should be scanned at a higher resolution.  Here is what you have enlarged to around 1.6MP.

• ###### 3. Re: How can I Expand Magic Wand Selection by Predetermined x, y?

Hello JJ-- yes, of course the original scans are about 1200x800 at 4800 dpi-- I've downsized for the example image.

Best, Ken

• ###### 4. Re: How can I Expand Magic Wand Selection by Predetermined x, y?

The the approch I wrote in your other append may be the way to go.

I think you would also need to design some interface to use when you script it and the strip would need to be aligned to the vertical well first. To pass some location information as to where the sprocket hole or holes you want to process and create a documents  with its frame's content.  A color sampler for example you can set up to ten of these before running your script.  Your script could use the magic wand on each of the points one at a time find the bounds of the a hole then set a selection relative to the holes bounds to select the frame rather then the hole and create a document with its content save it out and then move on to the next hole marked by a color sampler. I think you may find scripting something like that may work if all the film strips are from the same camera.  I think there may be some differences in hole location if the strips are not all from the same camera.

Get the hole's bounds calculate the frame's bounds then select the frame's content.  The file must be vertical

• ###### 5. Re: How can I Expand Magic Wand Selection by Predetermined x, y?

Bonjour

Why do not you use it instead
Selection/Color range...

Scripts with ScriptingListener

LAB color = 100

Then use the selections coordinates to work?

• ###### 6. Re: How can I Expand Magic Wand Selection by Predetermined x, y?

What color range would select a single  frame or socket hole so you can get its bounds?

• ###### 7. Re: How can I Expand Magic Wand Selection by Predetermined x, y?

Hum........

Color LAB

L=98

A=-0

B=-1

• ###### 8. Re: How can I Expand Magic Wand Selection by Predetermined x, y?

And what about the white lines you can see on the left and right border of the example from ?