Image Effects Image Effects by cecilia
The Wonderful World of Layers
-or- why does Dad look like a fruit?

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.



Ok. Time to plunge right in and make some layers!
Dad
fruity dad subtracted


Tutorial2:

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.

Xored


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:



/* layers_demo.ifx
  * layers demo. It assumes you have loaded a MAIN Buffer
  */

OPTIONS RESULTS
hook text
region full  /* to perform effect on Main Buffer not brush */
CreateLayer FromBrush
LayerName text
LayerMode Maximum



Here's a more useful script (just have one image loaded):


/* layers_demo2.ifx
  * ARexx Macro Recorded by CCShell 1.0.22 (21.2.99) by Ron Jensen
  */

hook text
region full
CreateLayer FromBrush
LayerName Shadow
scale
CreateLayer FromBrush
LayerName text
LayerMode Add
ActiveLayer Prev  /* selecting the middle layer */
LayerMode Darken


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:



/* layer_blur.ifx
  * ARexx Macro Recorded by CCShell 1.0.22 (21.2.99) by Ron Jensen
  * assumes a 3 layered image
  */

OPTIONS RESULTS

ActiveLayer Top
Hook PolarBlur 40 0 0 175 205 271 0 AntiAlias

ActiveLayer Prev
Hook PolarBlur 40 0 0 175 205 271 0 AntiAlias


/* ActiveLayer Prev
  * Hook PolarBlur 10 0 0 175 205 271 0 AntiAlias
  *
  * This is if you want to give the Background a little blur also
  */




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.




/* cloud_cover.ifx
  * ARexx Macro Recorded by CCShell 1.0.23 (22.2.99) by Ron Jensen
  */

OPTIONS RESULTS

ActiveColor 1
DrawMode Normal
DrawStyle Normal
Pen 0 1
Blend 100
AlphaChannel Off
EdgeMode Normal 0
FillMode Solid 0 0 0 SMOOTH
AirbrushSettings 5 50 0 Spray

CreateBuffer 320 200 0 0 0 1 1 100 100 FORCE
Hook Clouds FRAME 1 NUM 2 CD 1 CM RedFire PM Translucent CD 2

/* 'Hook Text TEXT="SPACE" FONT FuturaX.font SIZE 94 Center' */
/* I like to use a BIG font */
Hook Text

region full
createlayer frombrush
Hook gaussianblur 1.7 2 255
layername shadow
layermode subtract
layeroffset 16 66
Region Full
createlayer frombrush
Hook gaussianblur 1.7 2 255
layername text
hook clouds FRAME 1 NUM 2 CD 1 MS 256 TA 1 BD 129 PM Add CD 2
layeroffset 9 58



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.



The complete contents of this site are unless otherwise indicated.
The contents may not be reproduced in whole or part, in any form, without prior written consent from cecilia. You have been warned ;)

Need help with this topic? Email Me


Back to 
Articles