detail

Perl on your Mac part 2

By Jon Gales


If you missed my last lesson read
it before you read this one. If not you have a good change of being lost. If
you don’t feel 100% about last weeks lesson that is ok, you will after today.
The last lesson was a quick into to the basics of Perl, scalar variables and
the print function. We will be covering them both in more detail as well as
standard input and comments.

Scalar variables:

    • Always
    marked with a $ before ($scalar_variable)
    • Can contain A-Z, a-z, 0-9, and underscores in the name and must
    start with a letter.
    • Integers and character strings can be assigned as the value
    • Can be assigned different values in the same script such as:

    $one = 1;
    $one = 2; #$one now contains 2

    • Are
    case sensitive so $A and $a are two different scalars
    • Can be used in conjunction with each other such as:

    $one = 1;
    $two = 2;
    $answer = $one + $two;

    The operators
    for Scalar’s are

    as follows:

    Add

    =
    +
    Subtract

    =
    -
    Divide

    =
    /
    Multiply

    =
    *

    To increment
    a scalar (has to be a number) add ++ or — after it like:

    $value
    = 6;
    $value++; #the ++ increases the 6 to a 7
    print $value; #will print 7

    This is the
    principal that web counters work on. When a visitor visits the page it triggers
    a Perl script that reads a number from a file increases it by one prints it
    to the web and then prints it to file for the next time a hit is occurred.

Print
function:

The
print function is probably one of the most
important things you will need to learn
in Perl. Thankfully it is simple. Perl doesn’t
actually print things (on your printer)
it outputs them on screen. To print something
just put the following:

print
"WHAT YOU WANT TO PRINT";

You
can print scalars, strings, numbers, or
whole files (you will learn this at a later
date). Be careful to quote strings of text
(Perl will let you get away without quoting
scalar variables but not text strings).
Also don’t forget that ending semicolon.

Standard
Input:

We
briefly touched this in our last lesson
but not enough to thoroughly understand
it. The code for standard input looks like
this:

$VARIABLE_NAME
= <STDIN>;
chomp($VARIABLE_NAME);

That
chomp isn’t always needed but is a good
idea because sometimes input can get an
extra line in it and we don’t want that.
If there is nothing to chomp it does nothing.
This code picks up whatever was typed in
and dumps it into the $VARIABLE_NAME variable.

Comments:

Comments
are pieces of text that are solely meant for
human readers of the code. The computer automatically
ignores them. In Perl they are marked by a
pound sign #. Everything after a pound sign
is ignored. You have to comment every line
(there are no multi-line comments in Perl
like there are in C, PHP, and many other languages).
Commenting is a really really really really
(did I make my point?) good idea. Even if
you code looks good after your 5th Mountain
Dew at 3 a.m. I promise you it won’t look
good when your boss is looking over your shoulder
at 9 a.m. The first line of every Perl script
is a comment but this one isn’t ignored, it
tells the comp where to find Perl.


A
simple program using: Scalar Variables, Print
Function and Standard Input and comments is
below:

#!/usr/bin/perl
print "How old are you?
"; #prints
question
$age = <STDIN>; #puts response into
scalar
chomp($age);#get rid of that new line
$age_days = $age * 365; #times age by number
of days in a year
print "You are approximately $age_days
days old
"; #print answer

If
you are in X make the code a text file ending
in .pl and chmod it to 755. Then you can run
it by typing the path to file in the terminal.

 

Homework:
Your homework is to mess with the X
terminal. Practice writing stuff in pico and
chmoding it and moving around the directory.
Here are a few commands to get you started:


ls lists current directory
• cd changes directory (cd usr moves you
to the usr folder, cd / always moves you back
to the root directory).

If
you are on Classic you don’t have any homework
except to get OS X as soon as you can. It is
the future and kicks butt for Perl!

If you are having trouble or would like to ask me a question
please send me mail: jonknee@macmerc.com
or chat through AIM:
jonknee41 (add to buddy list)

Adobe Photoshop Tip– Add a little strength to details without ‘sharpening’

By: Rick Yaeger

This is a quick tip that will help greyscale images survive being printed in newspaper or run through a FAX machine. It utilizes a seldom used standard Photoshop filter called "High Pass".

What High Pass does is it isolates high-contrast image areas at a user specified pixel radius turning much of the image grey and leaving edge details untouched. The desired effect can be attained by adjusting the radius value — a setting of 100 will leave most images unaffected while a setting of 1 will turn an image almost entirely a monotone grey. Somewhere in the middle is a usefull filter waiting to be discovered.

Step 1: Bring your greyscale image into Photoshop and duplicate it on a second layer within the same document.
duplayer Adobe Photoshop Tip   Add a little strength to details without sharpening

highpass Adobe Photoshop Tip   Add a little strength to details without sharpening

Step 2: Find the High Pass filter under Filter>Other>High Pass… and apply the filter at a setting of 10 pixels.

What you will be left with is an image that may resemble a screen shot from a ’50′s era television broadcast. Don’t worry, it won’t for long.

levels Adobe Photoshop Tip   Add a little strength to details without sharpening

Step 3: Go to Image>Adjustments>Levels… and set the input levels to 0, 1.00, 128 and click Okay.

Now your duplicate layer should almost resemble a line art representation of the original.

multiply Adobe Photoshop Tip   Add a little strength to details without sharpening

Step 4: Change the layer blending options to "Multiply" from the layers pallette to apply this accentuated detail to the original.

before Adobe Photoshop Tip   Add a little strength to details without sharpeningafter Adobe Photoshop Tip   Add a little strength to details without sharpening

Step 5: If you would like to compaire this image to the original, you need only click and unclick the layer visibility icon (the eye) next to the duplicated layer in the layers pallette. If you decide you like how this technique strengthens the detail of your image, go ahead and flatten the image and use it in your project.

This technique has also been known to work on color images but not nearly as consistlently successful as on greyscale.

Read other Graphics Tips of the Week

Adobe Photoshop Tip– The Ubiquitous Aqua Text Tutorial

aquafinal Adobe Photoshop Tip   The Ubiquitous Aqua Text Tutorial

By: Rick Yaeger

We here at MacMerc have taken a lot of flack for certain articles that contain detailed explainations of activities we do not condone. The graphics tip before you may very well be added to their number. What I am about to explain, in great detail, is exactly how you can produce text similar to the large X on the box MacOS X comes in. I’m going to explain it, I’m even going to offer you the Photoshop Layer Style used to achieve it, but make no mistake, I do not condone the use of this tutorial. Aqua is everywhere and it’s being mimicked with varying degrees of success using third-party plug-ins and countless Layer Style Settings. It’s wrong and it has to stop.

aquastyles Adobe Photoshop Tip   The Ubiquitous Aqua Text TutorialSo why detail a graphic technique I don’t condone? For a few simple reasons:

  1. I intend to dispel the myth that a single Layer Style can produce this effect properly.
  2. As long as everyone is going to be using aqua type effects, they might as well do them well. And…
  3. I’ve been negligent in writing my graphics tips of late and this seemed like an easy way to get one in. I admit it, I’ve been bad.

One more warning before I continue, this tutorial is for Aqua type not Aqua buttons. If you want to make your own Aqua buttons there are plenty of great tutorials out there, but this is not one of them.

This tutorial is quite adaptable and might even produce fairly acceptable Aquafied logo effects. But, as you will see, the secret of the Aqua effect is in the highlighting and the highlighting used on Aqua type will not work as well for buttons as other techniques.

Anyway, enough warnings ó here we go.

Step 1: Type your type

aquajusttext Adobe Photoshop Tip   The Ubiquitous Aqua Text Tutorial

I don’t think there is a Mac forum in existence that has not had this question posed: “What font does Apple use?” The answer is Apple Garamond, it is evidently a font that Apple wants to keep to itself but if you know where to look, it’s not that hard to find. If using the authentic Apple font violates conditions of your parole, almost any flavor of Garamond Light Condensed will do. Load the font and launch Photoshop 7.

Start a new Photoshop document. I’m using a 7″ by 2″ 300ppi RGB file and all my instructions from here on out will assume you are working on a similar format.

I’ve typed “MacMerc.com” at 93pt in ITC Garamond Light Condensed. The color of the text doesn’t matter ó the Layer Style is going to override it anyway.

Step 2: Download and Apply the MacMerc Style

You are going to need to download and decompress this Layer Style to continue. Once you have it, open Photoshop’s Style palette and, using the menu in its top right hand corner, select “Load Styles…” and direct Photoshop to the style we’ve given you. It should now be added to you Style palette. With you text layer selected apply the “MacMerc Aqua!” style. If you think it looks pretty unimpressive so far, I agree.

UPDATE: If you are not using Adobe Photoshop 7, you will not be able to use the provided Layer Style. For users of older Photoshop versions, I have created this Photoshop file. All you need to do is download the file, open it in Photoshop, open your Styles palette and choose “Create New Style” by clicking on the middle icon at the bottom of the palette or by clicking in an empty area of the palette when the cursor turns into a paint bucket.

Photoshop 5.5 users can also use this file by opening it and chosing Effects>Copy Effects from under the Layer menu and choosing Effect>Paste Effects from the same menu to apply the effect to the desired layer.

Thanks to Iain Farrell for his help in making this tutorial more accessible.

Step 3: The Highlight of the effect

Create a new layer above the text layer and name it “Highlight”. Open the Layers palette if it isn’t already and confirm that the Highlight layer is selected while you Command-click the text layer. This makes a selection on the Highlight layer the exact shape and possition of the text on the layer below it. In the menu bar, go Select>Modify>Contract… and enter a value of 3. Fill this selection with white.

Next, with your selection still active and the Selection tool active (any one, the rectange, the circle ó it doesn’t matter), view your document at 100% and press the Down Arrow key on your keyboard 20 times. Go back to the menu bar and choose Select>Modify>Expand… and enter 10. Now go Select>Feather… and enter a value of 5 and then delete the contents of this selection on the Highlight layer.

You should now have a pretty passable Aqua text effect, but still not an impressive one. Please continue.

aquaunimpressive Adobe Photoshop Tip   The Ubiquitous Aqua Text Tutorial

Step 4: It’s all in the details

Creat a new layer between the text layer and the Highlight layer. Name it “Edge Glow – Bottom”. With this new layer selected, Command-click the type layer again and contract the selection by 3 pixles and fill it with white as you did to the Hightlight layer in Step 3.

Again, as in Step 3, we are going to nudge the selection. But this time we are going to nudge it up and we will only be going up 1 pixel (view your document at 100% and hit the Up arrow once with a Selection tool active). Now delete the contents of the selection.

Set the Blending Mode for Edge Glow – Bottom to “Overlay,” deselect and go Filter>Blur>Blur (I know, Gaussian Blur is the professionals “Blur of Choice” but plain old blur works just fine here).

Your Aqua type should be looking pretty sexy now, but we’re not down yet. We’re going to go that extra pixel to do this type up right.

aquadetails Adobe Photoshop Tip   The Ubiquitous Aqua Text TutorialStep 5: Details upon details

Creat one final layer above Edge Glow – Bottom and name it “Edge Glow – Top”. With this new layer selected, Command-click the type layer again and contract the selection by 3 pixles and fill it with white as you did to the Hightlight layer in Step 3. (Ever have deja vu?)

Again, as in Step 3 and 4, we are going to nudge the selection. This time nudge it down 1 pixel (view your document at 100% and hit the Down arrow once with a Selection tool active). Now delete the contents of the selection.

Set the Blending Mode for Edge Glow – Top to “Overlay” and that is it!

It’s interesting to note that if you select the text layer and apply almost any of Photoshop’s preset Styles, this technique still maintains its Aqua look. The Layer Style is only a small part of what makes it work.

aquafinal Adobe Photoshop Tip   The Ubiquitous Aqua Text Tutorial

Step 6: “Wait I thought I was finished”

The final step is to close the document without saving, trash that Layer Style you downloaded and never, ever use this tutorial. Go have a long shower and cleanse yourself of any grime of unoriginality that might have tempted you to actually use this effect for anything other than a joke. Shame on you! Shame!!!!

aquadontsave Adobe Photoshop Tip   The Ubiquitous Aqua Text Tutorial

Read other Graphics Tips of the Week