Every function that you can perform in the interface can also be executed in a Terminal window. The command line is perfect for when you know exactly (or almost exactly) what you want to do, and it's not very complicated. Its great benefit is speed. If you just want to use high-resolution images to make video-resolution copies with a change in color, typing that out in the command line may be easier than actually launching the interface and connecting all the nodes. Common Command-Line Uses - Resize, rotate, crop, or flip/flop images from film scans
- Add sharpening filters as you resize elements upward
- Change image file formats
- Place the luminance of an image into its alpha channel
- Load images into a flipbook for playback
- Render scripts
- Check a rendered, computer-generated element over a background plate
- Renumber and rename files
- Compare two images
Most importantly, you can also run commands remotely from the privacy of your own homeeven sitting in your underwear. When you log in to your office in the middle of the night, you'll really love that Shake has an expansive command-line feature set. Some Useful Unix Commands Unix is a popular multiuser, multitasking operating system. Originally designed in the early 1970s to be used only by programmers, Unix is known for its cryptic commands and general lack of user-friendliness. Though you would never know it, Mac OS X is based on Unix. You can run and execute Unix commands as well as Shake command-line functions in the OS X Terminal program. So getting familiar with some of the more common Unix commands is a good idea. Here are a few that you'll find useful: cd Note In Unix, using correct syntax is important. For example, cd ../will take you up one directory level, but cd.. (no space) will return cd..: Command not found. cp cp copies a file or files to a specified directory under the same name. If the destination file exists, it will be overwritten. Usage: cp file1 file2 or cp r files directory Options: ls Options: mv rm Loading a Single Image Ready or not, let's use Shake in the command line. 1. | Open the Terminal program, located in the Applications/Utilities folder. | 2. | Navigate to the Lesson14 folder using the cd command. If you copied the Lessons folder directly to your Macintosh hard drive using the instructions in the Getting Started section of this book, type cd APTS_Shake/Lessons/Lesson14 and press Enter. Note You must press the Enter key on the keyboard to execute command-line functions. Instead of typing out every letter of a file or folder, you can use the file-completion shortcut in the Terminal window: whenever you press the Tab key, a list will show you all potential files that match what you type. | 3. | Type shake batt and press the Tab key. This will list battle.iff for you. | 4. | Press Enter. The battle clip is shown in a Viewer. You can see the image name and resolution in the title bar. | 5. | Drag the left mouse button over the image to see the X-Y coordinate and the red, green, blue, and alpha values in the title bar. Shake measures the image starting in the bottom-left corner at 0,0. This means that the right edge will be the width of the image minus 1. The same goes for the top of the image. Here are some of the things that you can do in the Viewer: - Zoom in on the image with the and = keys near the Delete key.
- Pan the image using the right mouse button.
- Center the image and remove all zooming by pressing the Home key.
- View the red, green, blue, and alpha channels by pressing the R, G, B, or A keys. To go back to full color, press C.
- Close the image by pressing Esc.
| 6. | Close the battle.iff flipbook. Note When you are done with each command line, close the flipbook so you can move on to the next step. To view more than one image, enter multiple filenames. | 7. | Type shake plane.0001.iff bg.0001.iff Two flipbooks open, but you see only one, as they are placed one on top of the other. | 8. | Drag the title bar of bg.0001.iff to the side so you can see plane.0001.iff. | 9. | Close all flipbooks. Tip You can repeat previous commands by using the up arrow key on the command line. Each time you press it, it will list the previous command, stepping back through your history. Use the left and right arrow keys to change portions of the command. Pressing the down arrow key will take you to the next command in your history list. | Loading a Sequence Loading a sequence of images is just like loading a single image, except that you give a frame range and put a marker in the input filename that represents where the frames are. The marker can handle unpadded or padded frame numbers (for example, image.1 or image.0001). If you want padded frames, use #. For unpadded frames, use @. You can also use printlike formatting, such as %d, %04d, and so on. Finally, you may use an arbitrary number of @ signs for padding other than four digits. Here are some examples: Shake Format | Reads/Writes |
---|
image.#.iff | image.0001.iff, image.0002.iff | image.%04d.iff | image.0001.iff, image.0002.iff | image.@.iff | image.1.iff, image.2.iff | image.%d.iff | image.1.iff, image.2.iff | image.@@@.iff | image.001.iff, image.002.iff | image.%3d.iff | image.001.iff, image.002.iff |
1. | To load plane.0001.iff through plane.0030.iff, type shake plane.#.iff t 130 The t flag in the command line stands for time and specifies the frame range of your sequence. You should have 30 frames loaded in a flipbook. | 2. | To play the images, press . (the > key). | 3. | To play backward, press , (the < key). | 4. | To stop playing, press the spacebar. Here are some other things you can do with a flipbook: Using the t option to describe your frame range is an extremely flexible way to look at any variety or order of images. | 5. | Close the flipbook. | 6. | Type shake plane.#.iff t 130x2 Only odd frames1, 3, 5, and so onare loaded into the flipbook. | 7. | Step through the clip with the arrow keys. On the title bar, notice how the name of the clip updates showing every other frame. | 8. | Close the flipbook. | Comparing Images You can load two images simultaneously into a flipbook to compare them. 1. | Type shake jeans_fg.iff compare jeans_comp.iff | 2. | To compare the images, press ControlShiftleft mouse button and slide back and forth inside the flipbook. You can also: - Switch the compare buffers by pressing S.
- Toggle the vertical and horizontal splits by pressing V and H.
- Fade between the images by pressing F.
What's cool here is that the compare function works with moving images. | 3. | Close the flipbook. | Converting Files So far, you have been loading images into a flipbook, without putting an output file in the command line. To convert an image to a different file, merely add an output filename following the fileout command. 1. | Type shake battle.iff fileout battle_cry.jpg or | 2. | Type shake battle.iff fo battle_cry.jpg This writes battle.iff as the JPEG image battle_cry.jpg. If you want to convert an entire sequence, use the -t flag. | 3. | Type shake v battle.#.iff fo battle.@.rgb t 130 This will write battle.0001.iff as battle.1.rgb, up to frame 30. The @ sign sits in as the unpadded frame number symbol. Since you used the v (verbose) flag, Shake shows you how long each frame takes to render. Shake never makes explicit changes to the data in an image based on the file format that is being used. Thus, there would be no automatic log-to-linear conversion if you were to convert from the Cineon file format. To make such a conversion, include a delogc command. | Getting Help As you may suspect, there are a lot of Shake commands that you can execute in the Terminal window. There are a few methods (other than reading the Shake User Manual) for getting help in the command line. First of all, to figure out a command, you can type shake help command_name. 1. | Type shake help delogc In the Terminal window, Shake gives you the syntax for the delogc command: delogc [rOffset] [gOffset] [bOffset] [black] [white] [nGamma] [dGamma] [softClip] You can also get general help on a concept, such as multiplying. | 2. | Type shake help mul Shake returns the following output in the Terminal window: - imult - mmult - mult - multilayer - multiplane - multiply | 3. | If you would like to see a complete list of commands, type shake help This displays a list of every single Shake command, as well as any macros that you created. | Getting Image Info Shake can quickly get information about an image with the info command. If you are using this option, it will not pop the image into a flipbook but instead will give you a text output in the Terminal window: 1. | Type shake battle.iff info In the shell window, you'll see the following: Filename: battle.iff Type: RGBA Size: 478x560 Depth: 8 bits Z-Buffer: none Format: Shake It gives you lots of info that is pretty self-explanatory. If you change the parameters, the info command will reflect this. | 2. | Type shake battle.iff zoom 2 bytes 2 reorder rgbn info In the shell window, you'll see the following: Filename: battle.iff Type: RGB Size: 956x1120 Depth: 16 bits Z-Buffer: none Format: Shake I zoomed up the image with zoom, which gives me a higher resolution. I also put in 2 bytes per channel, which gives me a bit depth of 16 bits, and I stripped out the alpha channel (n in the reorder option means no channel), leaving a three-channel image. Shake doesn't process the image unless you use a fileout command followed by an output image. | Basic Command-Line Compositing Basic compositing on the command line can be very useful, especially for testing composites. Let's start by viewing the elements. 1. | Type shake bg.#.iff t 152 and play the clip when it is done loading. This is the live-action background plate. | 2. | Close the flipbook when you are finished looking at it. | 3. | Make flipbooks of the bullet.1-52.iff and smoke.1-52.iff clips and play them. The bullet and smoke clips are computer-generated elements that you'll composite with the background. | 4. | Close all open flipbooks. | 5. | Type shake bullet.#.iff over bg.#.iff t 152 and play the composite when it is done loading. The bullet is composited over the background and looks pretty good, but you still need to add the smoke. | 6. | Type shake smoke.#.iff over bullet.#.iff over bg.#.iff t 152 The bullet and smoke have been composited very quickly. This is a great way to test your elements without wasting any time. | 7. | Close the flipbook. | Are you feeling pretty cocky right now? If so, you're ready for the next step. Let's raise the bar and try a more complicated command-line composite. |