Beginning with version 3.0 of ImageFX we now can manipulate images with layers. Like Homer Simpson, I say, "Woo Hoo!" But don't panic. It's not scary or as complicated as you think. First thing you have to do is visualize what layers are. Make believe you are putting together a Bugs Bunny cartoon (isn't that everybody's dream?). First you paint the BACKGROUND. It's usually some landscape. Trees for banging into, cliffs in the distance for falling off of, etc. On TOP of this background you place a cel with Bugs standing there with that Attitude that distinguishes him as the best cartoon character of all time. Part of the cel is transparent, but the part that has been painted with Bugs is opaque. (Bear with me, I state the obvious for a reason). And maybe there is another cel placed ABOVE Bugs in which airbrushed clouds or highlights have been applied. We have three layers and the relationship between them is important.
The bottom doesn't change. It's always going to be the bottom. Every other layer above the base can have parts that are transparent.
Let's think about these relationships within ImageFX. When you decide to make a layered project the first buffer loaded or created is automatically the BACKGROUND. As soon as you load or create a layer that first image even gets named BACKGROUND! And unlike any other layer above it, BACKGROUND cannot be moved UP. It's tacked to the bottom. And it can never be transparent. If you think about it, it's quite obvious that it can never be translucent to an unseen nonexistent "behind". Gee, I'm starting to scare myself!
If you wish to follow along with the tutorial, you will need to first download the tutorial file archive here: layers.zip.
1. Load Dad.iff (that's my father way before I was born. He was 45 at my birth so I always saw him as graying. Here he looks like a member of the Mafia or a lawyer. Which I think is funny since he really was a college professor with Ph.D.). Anyway, Dad will become the BACKGROUND. Steady as a rock, dad.
2. Open the Layer Manager. See that little button to the left of the RGB channel buttons on the Toolbox? Click that and the window opens. It says there are no layers because there's only one image. °Layers Tip°
3. There's a button to the right of the name box (which says "Dad.iff"). This button has a downpointing arrow and if pressed will pop up a list of things you can do with layers. The first command says, "New Layer..." Move your mouse pointer to highlight that and let go. There should now be a layer over Dad.
4. This new layer is Black and RGB by default. I know you don't see it - yet. Click the "eye" that's on the same line as BACKGROUND to make Dad's layer invisible. See the black? You don't see it when Dad's layer is visible because the black is transparent. It's like putting a clean cel over the cartoon background. This will become the Mask layer. We'll paint in it to make parts of it opaque. But first -
5. Load rasp.iff as the top layer. We are going to surround Dad with berries.
6. Have the rasp.iff layer highlighted in the Layer Manager. °Layers Tip° At the bottom of the window is a Blend slider. Move the slider down at least half to make the berries less opaque. That's so we can temporarily see Dad and the berries together. Click twice on the Mask.iff layer so that the Layer Settings window opens. Check "Mask Layer?" Click Okay. It's now Officially a Mask. That is: parts can be transparent and parts can be made opaque to the BACKGROUND by painting on it.
7. The Mask should still be selected. Pick white as your draw color. Now you can follow Dad's outline while painting in the Mask layer so we can see the berries around him. I know it's a little weird to draw on something that you don't directly see but instead are looking at the results, but you'll get used to it. After all in previous versions of ImageFX you used the Lightable to see the SWAP buffer under the MAIN buffer. So this shouldn't be so hard to follow.
Dad's silhouette should stay black. Just draw right to the edges. When done drawing apply a GaussianBlur to the layer. Just a little - 1.7 or less - and the edges of the matte will be nice and feathered. OOH!
Now, don't get mad (!) but I've already made "mask.iff" which you can use instead of rolling your own for this tutorial. But you should know how to make your own mask layers. Which is why I tortured you with the explanation. (heh, heh) So you can choose to use mine or yours. If you wish to use mine then here's how to get rid of your mask layer, if you made it. Select it and use the [Delete Layer...] command. Be careful with these commands, they don't ask if you're sure, and they can't be undone. Now you can [Load Layer] and load "mask.iff". All layers made or loaded are put at the top of the list by default. But you want it just above Dad. Select it, and use the [Layer Down] command on the list. Don't forget to open the Settings window, Check "Mask Layer?" and Click Okay.
8. Now select "rasp.iff" layer. Move the Blend % up to 100 (or so). Open the Settings and try a few cool composite effects. Try Absolute Subtract and see what that does to the berries! I love the instant feedback.
Now what would happen if we reversed the order of the layers? If it's SO important, would it really affect the way the images composited? Well, let's see.
1. Start a new buffer and Load "rasp.iff" This now becomes the anchor of this layered experiment.
2. In the Layer Manager click the down arrow button and select "Load Layer..." and load "mask.iff"
3. Load Layer again and pick "Dad.iff" Now, when you select the mask layer and make it a Mask, Dad is full of berries! That's because the layer positions have been reversed. See how important they are! And you thought I was kidding! At this point click on those small "eyes" at the right end of the layer names to "turn on" and "off" each layer to see it or not see it. To see the mask go into the Settings and click off the Make Mask button. Do this until the full realization of layer-relationship dawns on you. It's almost like having a religious experience. No. I'm not kidding. When I was first figuring out layers I had an epiphany at about this time.
Now that you've seen Nirvana, almost, lets play with Dad and the fruit. You can leave Dad fruity or we can get him out of this pickle. So, select the mask layer, click [Color/Negative] to reverse the mask layer and now Dad can be seen with the berries around him. So why change the layer order this way? It almost looks like the first way we loaded the layers in Tutorial 1.
4. Well, NOW you can select Dad and open the Settings to change the Modes. Try Xor for fun. Dad looks all berry berry. I wouldn't be able to do that if Dad was the BACKGROUND. Go ahead, open the Settings for the BACKGROUND. The compositing modes are ghosted. Remember I said you can't composite the BACKGROUND with the Nothing under it? You could alter the BACKGROUND buffer with any of the usual effects like straw or Hockney Tiles, for example, but only other top layers can composite OVER it. And the X Y offsets are ghosted because all the other layers move around in relation to the Background. Am I belaboring this point? I hope not. It's real important.
Add more layers:
Feel free to load the Mask layer on top (4th layer), then [Clone LAYER...] or load the rasp layer. After turning on the second Mask, you can preform different processes on the raspberries or Dad and watch the light show till the cows come home. Others play video games, I just want my ImageFX-TV!
By the way, Cloning a Layer will move the Offset a little. Leave it as is or change the Offset by opening the Settings and returning the numbers to the original layer position. Loading a layer will always position it at "0,0"Layers And Arexx
Ah, I always come back to that. No matter what new thing NovaDesign comes up with I want to see if it works in a script. Because Batching and Automating are GOOD. Well, the good news is that Layers can be controlled by Arexx. The semi-bad news is that the macro recorder will not record all your actions in the layer manager. I've gone through all the listed commands for layers and they all mostly work.I compiled this info in this article: Arexx Layer Commands.
However, here's a few caveats for writing some commands: Before you invoke CreateLayer FromBrush or any of the ActiveLayer commands (Next, Prev, and Top) you need to have a full region selected. If you made or loaded a text brush you must then invoke the RegionFull command otherwise the software will try to preform these layer commands on the brush not the buffer. Which is just plain silly. Here's a script I made to illustrate:
When the scale command opens the GUI, scale it up just a little bit. No more than 10%. When the script has run its course, select the layer called "Shadow". Click on the down arrow in the layers manager and select [Move Layer]. You won't see anything happen but if you click in the MAIN buffer you'll notice a box with cross marks which is the boundary of that layer and you can position it exactly where you want it. And as you move it, you'll see the results. This is the manual version of the Offset X and Y positions seen in all Layer Settings. This is great for positioning titles and moving those alien space crafts around. Notice that you don't need to make a Mask layer when you create a layer from a brush. That's because a brush already has a mask, obviously. This ease of use brings me back to those early heady Amiga days when all we had was DeluxePaint. And we were in heaven.
Let's play with Dad again now that we are using scripts. Load up Dad, his mask, and those berries (in any order you wish except mask has to be in the middle, natch!). Here's a fun script you can now run:
This puppy will make an effect that photographers just love. That explosion event. You don't have to do it to all the layers. In fact doing it to the mask layer will give Dad a sort-of halo look, which looks cool to me. I can't tell you how many permutations I've tried just during the writing of this article. And it's been fun every minute.
One little minor point concerning scripts. You may have noticed that the Blend % in the Layer Manager goes from "0" to "100". Logical. Well, when I was trying out the LayerBlend command it's range goes from "0" to "255". Err. Looking up the command in the help files reveals that that's the way it's been set up. Well, it works but if you write the command, "LayerBlend 50" and expect it to be 50% you're in for a surprise. A 50% would be more like LayerBlend 127 (that's half of 255). Use a bit of algebra when writing scripts with this command and you should be ok. You have been warned.
Here's another script that will make buffers from the Cloud hook. You don't need any buffers loaded. It will create everything. It will make a text brush which gets painted by the cloud hook and puts a shadow of the text under it. Simple.
In case you're wondering what all that "CCShell by Ron Jensen" is all about, here's the skinny. Ron is a mild mannered reporter...oh, that's someone else. Ron is an amazing programmer and you can find some of his hooks and other fun stuff at: Ron's wonderoma of stuff And I'll be discussing those hooks in a future article.
While I was preparing this essay I became annoyed that the macro recorder couldn't write the layer commands as I was doing them and I complained to Ron. Well, before I could say, "Yippy, Skippy", he sent me a little hook he wrote - CCShell. It's like the ESC shell that comes with ImageFX but it will start a macro and when I type in the layer commands I can see what they do and it sends it to the script. Ok, I still have to type, but I got this in one day. I'm a sucker for the personal touch. Besides, I'm planning on bigger things for the future. I can't let someone this talented escape from my plans of world domination.
Now, one thing you should do is Save Early, Save Often. And while you are working on a layered picture save it as an ingf. This is the ImageFX Native Graphics Format which saves or loads all the layers and compositing modes. When your masterpiece is perfect use the [Flatten Layers...] command. It can't be undone so be careful.
Need help with this topic? Email Me