Odd/Even Fields – Removing Pixel Rows In PS

TH
Posted By
Tom_Hanser
Dec 4, 2008
Views
733
Replies
13
Status
Closed
This is hard to explain, but I have a challenging task here in PS. There has to be a way to do this!

I have to make our video engineering dept. two separate files, one containing the EVEN rows of pixels, and one file with the ODD rows of pixels.

BUT, I have to collapse the space between each pixel row, truncating the file height in half.

I have produced two master PSD files now, 854×480 WVGA format. I created a grid of selections (saved as an alpha channel) for ODD rows and EVEN rows, and deleted the unnecessary rows. If you were to layer these two files together, the image would appear seamlessly.

OK, fine. I almost have what I want, but I’m not done yet.

What I have to do now is to remove the space between each pixel row (the transparent rows), truncating the file height to 240 pixels high.

Yes, I know the final image will appear "odd", but this is for technology development purposes.

Can anyone offer a procedure to remove the rows of transparent pixels, resulting in a shorter file height?

I could post a PSD, I suppose, if someone wanted to see what I’m starting with.

If each pixel row were on an individual layer, I could distribute the layers, one on top of the other. But moving each pixel row would mean 240 layers.

There has to be another way.

I’m thinking there might be a method of doing this in AE if I can’t do this in PS.

Thanks so much.

Master Retouching Hair

Learn how to rescue details, remove flyaways, add volume, and enhance the definition of hair in any photo. We break down every tool and technique in Photoshop to get picture-perfect hair, every time.

JM
J_Maloney
Dec 5, 2008
For odd pic (for even pic start on 2): Record: select row 1. Copy/paste (layer 1 created). Now record: select layer trans, move selection 2 pix down, select background, copy, paste, move layer to front layer. Now you make the action dupe those second steps 239 times. Then have the action link/select all the layers and align to top. Then have the action unlink everything and move layer 240 down 239 pix. Then link everything and distribute centers. Flatten.

This method is totally dependent on the files being of a certain size, but it sounds like you have that controlled. Building the action will be a pain. But then again, if it’s complicated it feels so good (I’m important!).
TH
Tom_Hanser
Dec 5, 2008
Mr. Maloney – thanks! Let me try this approach. I have to try SOMETHING.

In Illustrator you can release selections to new layers, but not in PS.

Let’s give this a try.
P
PeterK.
Dec 5, 2008
Are you trying to de-interlace? There’s an option under Filter-Video-De-Interlace, but it interpolates in pixels.
TH
Tom_Hanser
Dec 5, 2008
Not quite de-interlace, no. I thought of that, and I’ve used it before on frame grabs.

There are alternating pixel rows that are missing (transparent) that I want to REMOVE, and consequently shorten the height of the file.

If each pixel row were on a separate layer, I could distribute them precisely on top of each other.

I will end up with two files eventually, one containing the ODD fields, and one containing the EVEN fields. But these files will NOT contain the transparent (missing) pixel rows.

Hard to explain, but Thank You!
JM
J_Maloney
Dec 5, 2008
Tom:

I would process one file at a time, creating even and odd files, as opposed to breaking out two files using masks (as you seem to describe) and then processing those. I’m 95% sure you can action this to a batchable action (serial numbered even/odd files, not filename-prefix, if that makes sense). When creating the 239 dupes: dupe one set, then select both sets, dupe both, then select four, dupe those and so on. Do this in a blank action to make it easy to determine what you’re duping. I created an action with 1024 sets of steps this way, which is more than enough to process both even/odd files, link everything, copy merged, save out, etc. If you’re using CS3 the linking is much more simple: link layers 1 through 240 selecting all, vs: select layer 1, layer 2, layer 3, …

If you merge linked and copy to a new file called "odd," then when you batch the action you can create 001_odd.psd, 001_even.psd, 002_odd.psd, 002_even.psd, … Get the receiver to sign off on receiving renamed files and then no handwork for you. Or bug the scripting folks in that forum and they might be able to help you with naming the resultant files based on original.

J
JM
J_Maloney
Dec 5, 2008
But I think Peter’s right. Deinterlace and then resample nearest neighbor 1/2 vertical should do it.
P
PeterK.
Dec 5, 2008
It sounds like he absolutely needs the two separate files, with the odds and evens chopped out and the final images being half the original height. If that’s the case, then deinterlacing won’t help, but if the point was to get a final image from two images, one containing the important info in the odds and the other the info from the evens, then you could do something via deinterlace, then with a difference layer to generate an alpha mask and knock out one from the other, or just making the mask manually.
JM
J_Maloney
Dec 5, 2008
I’m pretty sure de-interlace set to duplicate and then a vertical image size (down to 854 by 240, nearest neighbor) will get him exactly the file he desires. Certainly exactly the file my rocking action would produce. Counter-intuitively, he’ll need to use the even setting for odds and odd for evens. He’ll need to de-interlace the image twice to get the two files.
P
PeterK.
Dec 5, 2008
You could cut out the transparent areas without using multiple layers. I wasn’t sure if all of these actions would be actionable but it looks like they work fine.
Setting a marquee selection to 1px height and the width of the image, you can record an action that selects the top row of pixels, switch to move tool, nudge it down one row (to cover the transparent row below), switch back to marquee tool, hold shift and add to your selection so you have the two rows of pixels selected, nudge down, shift-select to add the third row, nudge down, etc. After all the rows have been moved down into the bottom half of your canvas, go to Image-Trim-transparent pixels.
After you make your first selection, begin recording the action of moving and selecting subsequent rows, then you can simply run the action on either your odd or even images after selecting the top row of pixels. It’s a lot of manual work to do the first time, but after that it’s just a matter of clicking a button.
P
PeterK.
Dec 5, 2008
I’m pretty sure de-interlace set to duplicate and then a vertical image size (down to 854 by 240, nearest neighbor) will get him exactly the file he desires.

Ah, didn’t see the part about image sizing. Yes, using nearest neighbour should just knock out every other line. In that case, deinterlace on dupe and image size with nearest neighbour would be really simple!
JM
J_Maloney
Dec 5, 2008
PeterK:

If you get the file already parsed, just run de-interlace duplicate and then scale down. Don’t go repeating my foolishness! Patent pending and all. 🙂
JM
J_Maloney
Dec 5, 2008
You got it! Are you making fun of me? 🙂
PR
Paul_R
Dec 5, 2008
One more way, start with a document with just a background, run script, remove background and flatten and save.
Start all over again this time uncomment line 5 and comment line 6.

var startRulerUnits = preferences.rulerUnits;

preferences.rulerUnits = Units.PIXELS;

var doc=activeDocument;

var Height = doc.height.value;

//for(var a = 1,z =1; a<height;a++,a++,z++){

for(var a = 0,z =0; a<Height;a++,a++,z++){

doc.activeLayer = doc.artLayers.getByName("Background");

selectLine(a);

doc.selection.copy();

doc.selection.deselect();

selectLine(z);

doc.paste();

doc.selection.deselect();

}

preferences.rulerUnits=startRulerUnits;

function selectLine(lineNo){

var Width = activeDocument.width.value;

var selRegion = Array(

Array(0, lineNo),

Array(Width, lineNo),

Array(Width, lineNo+1),

Array(0, lineNo+1),

Array(0, lineNo)

);

activeDocument.selection.select(selRegion);

}

MacBook Pro 16” Mockups 🔥

– in 4 materials (clay versions included)

– 12 scenes

– 48 MacBook Pro 16″ mockups

– 6000 x 4500 px

Related Discussion Topics

Nice and short text about related topics in discussion sections