Handy new script for Photoshop CS3

By now you’ve probably seen how the Photoshop CS3 beta’s Auto-Align Layers command can snap images together.  If not, check out my 90-second overview, or this somewhat more in-depth version from Russell Brown. 

The command relies on selecting multiple layers to align, so it’s handy to suck multiple images into Photoshop & stack them up as layers in a PSD file.  To accomplish that easily, we created a Load Files Into Stack script, but time didn’t permit it to get into the beta.  So, if you’re interested in pulling in multiple files as layers, you can grab the script here (zipped to avoid any server weirdness).  Unzip the file and stick it into the "Adobe Photoshop CS3/Presets/Scripts" folder to make it appear under File->Scripts when you launch Photoshop, or just browse to it via File->Scripts->Browse.

To try it yourself, do the following:

  1. Grab this set of four images and unzip it.
  2. From within Photoshop, select File->Scripts->Load Files into Stack, then load up the four images.
  3. Leave the alignment & Smart Object options unchecked, then hit OK.
  4. Choose Select->All Layers, then choose Edit->Auto-Align Layers.
  5. Click the Cylindrical option, then hit OK.  You should wind up with an image like this.
  6. So, okay, Photoshop has done a reasonable job aligning and warping the layers, but obvious color and alignment problems remain. To address these, now choose Edit->Auto-Blend Layers.  You’ll wind up with an image like this–much more nicely stitched together.
  7. Notice that the Auto-Blend command still leaves your layers as layers, but they now have layer masks that you can further tweak by hand if you’d like.

The upshot is that the Load Files Into Stack script sets you up nicely for all kinds of alignment & blending tasks, or for any work that requires multiple files to be pulled into a single layered document.

On a marginally related note, a customer on the Labs forum was asking about getting a native version of Photoshop’s JPEG 2000 plug-in, which isn’t installed by default.  So, here you go (Mac and Windows bundled into one ZIP, since they’re small).

0 thoughts on “Handy new script for Photoshop CS3

  1. John,
    Dude, you guys rock. What else can I say? The question I have now is will it work with scientific images? Guess I’ll have to give it a try. 🙂

  2. On the subject of the new Auto Align and Photomerge tools, I’ve long been wondering, is there a rule of them as to which perspetive mode to use? I’ve been simply using auto, but you used cylindrical and Russell Brown seems to enjoy perspective. Maybe it’s on a per-case basis, but I was just wondering.
    [Good question. Let me see what info I can gather. –J.]

  3. This might not be the right place for this question, but I’ve been asking it every since CS3 Beta came out.
    Why should someone download and use it now? It will only expire once the software actually is released. No permanent or long-term work can be done. And when it is released, couldn’t it be different in many respects, all requiring a new learning curve?
    I just don’t understand the expressed urgency and need to download something so large (of course, I’m speaking from a dial-up perspective) when it will only last a month or so.
    Just wondering.
    [First of all, the CS3 release is many months away. But as for why? Users of Intel-based Mac have been clamoring for native performance, and we wanted to give it to them as soon as we had something stable and solid. It’s totally up to you whether you want to use it; no pressure either way. –J.]

  4. how about a plugin like Corel Knockout 2?
    [Have you seen Photoshop’s Extract tool? But how about we try to make something faster and easier to use? Check out the videos for the Quick Selection tool and Refine Edge command. –J.]

  5. This script will be killer. And the cool thing is I just asked for something like this on John’s other post. Thanks John! Come to KC and we’ll go out to dinner.
    [Glad you like it, Mike. I’m into KC BBQ, but I’ll extend the offer to the people who actually wrote the script. 🙂 –J.]
    Now I wonder if I can hack it to work with CS2. Hmm, opening the javascript, I think it’s too much for me, though the script is pretty concise. Great work!

  6. John:
    I went to load your script into the prescribed folder and found that there was already a script by that name.
    What do you think?
    [Wick, I should have mentioned that the script is present in the beta, but not in a form that’ll work properly. You can replace it with the one I posted. –J.]

  7. John, I’ve been looking through the javascript code. Does “transformActiveLayer()” actually allow one to set the 4 destination corners for a free transform? This is something that I’ve been hoping for for a long time.
    Also, can you or anyone within Adobe explain your implementation of SIFT and how to plug into this with javascript?
    [Rich, let me see what I can find out. With most of this stuff, you know, I’m just the talking head and have to consult with the people who actually know what’s going on. 😉 –J.]

  8. John, I know you must all be very busy after the break, but when you get a chance could you ask around about the above inquiries?
    Thanks.

  9. Another dimension to the auto/align and photomerge capability is to support it temporally (v. spatially as in panoramas). For example a handheld sequence of shots with kids at Disneyland’s castle. Using the inherent alignment, blending, and masking plus layer subtraction you can (automatically) mask out the other 5,000 people moving in and out of your shot(s) and Voila! Looks like you had the whole theme park to yourselves!
    [Oh yes–lots of interesting possibilities here. –J.]

  10. I was really hoping that the Auto-align Layers feature would somehow take masks into account, but it doesn’t appear to.
    [That’s something we’re evaluating & may add by the time we actually ship CS3. –J.]
    Ideally it would work like this:
    1. Get the two layers into a document in the stack form.
    2. Decide what parts of the two images you want to be aligned. Make a selection around these areas and then turn them into layer masks for each layer.
    3. Call Auto-align Layers.
    4. This will run the SIFT algorithm, but will use the layer masks as weighting for point correspondences found. That is, where the mask is black, those points don’t count in calculating the transform to do. White areas count full weight and then you have a range of 254 values in between.
    5. If not enough point correspondences are found in the particular region, rerun SIFT with a temporary, contrast improving function applied to the images first.
    Right now auto-align is great if things were shot with a fairly pure camera rotation. Introduce even a little position change and you get parallax so that there will be no one compromise that will work for the alignment (unless you reverse the scaling effects of perspective). Anyway, this mask solution would let the user decide what compromise should be made. Computer vision has come a long way, but the human brain is still significantly better at things like this. Plus, artistic control is a big deal in a program like Photoshop.

  11. is there a “load files into stack” script for cs2? i know of the russel brown bridge option, but just curious for the psd only option.
    [Russell’s script is the only one I know of, though someone could certainly write one to work with CS2. –J.]

  12. John, you should look into a little program named Helicon Focus. It does a stacking thing similar to your “load files into a stack” but goes a step futher and only picks the “in focus” portion of each image and then put the “in focus” together in one image. The site is http://www.heliconfocus.com
    and thanks for a wonderful blog.
    Lee
    [Thanks for link & kind words, Lee. Ive heard of Helion Focus in the past but haven’t gotten to try it out. –J.]

  13. any tips to try to get a spherical pano to stitch with the new auto-align layers feature? or would a spherical option be added to the final release? the cylinders i’ve been stitching with cs3 and then auto-blending have been looking great. and this process is a lot faster than other stitching only aps i’ve used. just wondering.
    [Glad you’re digging it, as am I. We don’t have any plans to enable spherical stitching in CS3, but maybe that’s something that could be enabled in the future. I’ve passed the suggestion along to the right people. –J.]

  14. I know this isn’t a Photoshop Support Site, but I don’t really know where to look. I tried to go through this tutorial, but my Photoshop CS3 (on windows vista) is no longer allowing me to open multiple documents.
    As soon as I try to open two documents at once, it crashes. Can you please tell me where I should look for support on this issue?

  15. this stuff rock quite hard. Yet, as a lazy bastard as iam, i was wondering if there would be such a way to , press a button while we are sellecting these pictures prior to loading them to ps, and gather them in ps just like the script does.

Leave a Reply

Your email address will not be published. Required fields are marked *