This question comes in from Sara Ford:
I am having a problem with Illustrator that seems pretty basic, but I just can’t figure it out. I placed a picture into my document, and I just want to add a stroke around it. But when I do, the line doesn’t show up? What am I doing wrong?
In reality, I get this question a lot. The problem is that unlike InDesign, which has a concept of frames (and the frames have Fill and Stroke attributes), Illustrator is frameless (others may use the term spineless, but we won't go there now). The "problem" that exists is that a placed image in Illustrator isn't an object that can have Fills or Strokes. It's not a vector shape and therefore lacks those attributes.
Most people take the "easy" route and simply use the Rectangle tool to draw a shape around the image. But even that is too much work. Let's explore some ways to "solve" the "problem" at hand...
First, it's important to understand that a placed image is not a vector object, and hence, can't have a fill or stroke attribute. So we'll need to create another vector object to contain our stroke attribute. But I don't want to create that object on my own. I want Illustrator to create it for me. There are basically two ways to accomplish this: have Illustrator automatically create a mask for the image; or use an effect to convert the bounds of the object into a vector object. Both have pros and cons and work better depending on the task at hand. Ready to discuss? Let's go!
USING A MASK
This technique requires the use of Illustrator CS3 and will work only when your keyline will be rectangular in shape.
1. Choose File > Place and choose an image to place into your Illustrator document. You can either Link or Embed the image. Once you've chosen the image, click the Place button.
2. The image is selected (or if your image already exists in your document, select it), so if you look in your Control panel at the top of the screen, you'll see a button labeled "MASK". Click on it. This creates a mask at the exact bounds of the image.
3. Press the "D" key for Default. This will give the mask a black 1 pt stroke attribute. Feel free to adjust the stroke per your design needs (who uses a 1 pt stroke anyway?).
NOTE: An additional benefit to this method of using a mask is that you now have the elements in place to simulate a "frame and image" paradigm like InDesign. Once you've created your mask, you can decide to "crop" your image by double clicking anywhere on the photo. This will put you into Isolation Mode. Now click on the frame edge and resize at will. When you're done, double click outside the image to exit isolation mode and continue working. This method works wonderfully when you're using the Selection tool (black arrow) and have the Bounding Box option turned on (in the View menu).
USING AN EFFECT
At first, it may seem that applying a keyline with the use of an Effect is a tedious process. But we all know that once we've applied an effect, we can store it as a Graphic Style, at which point applying our keyline will become a single click. Go ahead, ask me why Adobe doesn't ship Illustrator with such an effect as a default setting in the NDPs (New Document Profiles). Go ahead, ask me why Adobe doesn't allow us to assign keyboard shortcuts to styles like InDesign does. I don't have answers to either of those questions (sorry). But let's get on with the styles, shall we? There are two separate effects that we can use, and each provides a different benefit.
1. Choose File > Place and choose an image to place into your Illustrator document. You can either Link or Embed the image. Once you've chosen the image, click the Place button.
2. The image is selected (or if your image already exists in your document, select it). Open your Appearance panel and from the Appearance panel flyout menu, choose Add New Stroke. We can't see the stroke yet, because all we have is an image. But we'll change that in short order.
3. With the Stroke highlighted in the Appearance panel, choose Effect > Convert to Shape > Rectangle. Check the Preview button, Select the Relative option, and set both the Extra Width and Extra Height to zero (0). (Careful not to press Tab after you enter the second value or it will switch back to Absolute.) Click OK to apply the effect. If you'd like, style the stroke attribute to match your design preference (again, who uses a 1 pt stroke?).
4. To make this easier to apply in the future, with the object still selected, open the Graphic Styles panel and click the New Graphic Style button at the bottom of the panel. Give the style an appropriate name. It would be a good idea to add this style to your NDPs so that it will be readily available in all new files that you create.
This technique obviously only works if your keyline is rectangular in shape. But what if your image had transparent areas in it? What if you silhouetted the photo in Photoshop (keeping the background transparent), and placed the PSD into Illustrator? Is there a way to apply a stroke to the boundary of the ART instead of to the boundary of the entire image? The technique I'm about to show you will do just that, and will also do the job for rectangles as well.
1. Choose File > Place and choose an image to place into your Illustrator document. You can either Link or Embed the image. Once you've chosen the image, click the Place button.
2. The image is selected (or if your image already exists in your document, select it). Open your Appearance panel and from the Appearance panel flyout menu, choose Add New Stroke. We can't see the stroke yet, because all we have is an image. But we'll change that in short order.
3. With the Stroke highlighted in the Appearance panel, choose Effect > Path > Outline Object. If you'd like, style the stroke attribute to match your design preference (again, who uses a 1 pt stroke?).
4. To make this easier to apply in the future, with the object still selected, open the Graphic Styles panel and click the New Graphic Style button at the bottom of the panel. Give the style an appropriate name. It would be a good idea to add this style to your NDPs so that it will be readily available in all new files that you create.
It just so happens that if you're applying this last effect to an image with no transparency, only the outside portion of the stroke will become visible. Meaning that if you're stroke weight was set to 1 pt, only .5 pt of the stroke will be visible. To get the full 1 pt stroke, select the Stroke attribute in the Appearance panel and choose Effect > Path > Offset path and choose an offset amount that's half the weight of the stroke. In our example, you would use a .5 pt offset value.
For even more fun, you can combine BOTH of these effects (simply by adding two strokes to your image), hence giving your transparent images a stroke around the bounds of the artwork as well as a keyline around the bounds of the entire image.
18 comments:
Once again a terrific answer to a question that many of us have no doubt had. I know I had wondered about this. Thanks. Now how about jagged looking shapes in Illustrator that save out as clean images when saved as jpegs, etc but don't look good on screen in Illustrator? Any thoughts on that (I send you a personal E-mail with pictures to show what I mean).
Cheers,
Gary.
Great tip. Thanks!
I've been using Illustrator more and more (now that Freehand has been relegated to the graveyard and our wire services have all switched over to Illustrator) and have bumped up against some problems I cannot figure out. Some -- like easy conversion between types of type boxes -- seem to be undoable in the program.
One biggie for me is editing embedded images. In Freehand it is extremely easy to edit embedded images (convert to grayscale, adjust levels, sharpen, etd.) but I cannot figure out if there is a similar way to do that in Illustrator. The best I can find is to copy the image, place it into a new image in Photoshop, edit, save, place back in Illustrator document and then position back into place. Do you know of any easier way to accomplish this?
Thanks for the great work here and helping me better learn to use the program.
-Wes
As I play with this I just wanted to point out (for other newbies such as myself)that you can round the corners on the border quite nicely and use the powerful Appearance panel to change the stroke color on any new images to which the Graphic styles saved border is applied to.
The Appearance Panel should be a different color or size to indicate its vast importance in doing really neat things in Illustrator. As you know many users have no idea of its existence or how best to use it.
Cool!
gary - thanks. I do agree that more people need to realize that the Appearance panel wields much power. Hopefully Adobe will see that and add more functionality to it and make its presence more well known.
wes - glad to be of help. With regard to embedded images, there are a few things I can suggest to make life easier. First, you can convert embedded images to grayscale in CS3 by choosing Edit > Edit Colors > Convert to Grayscale. You can also use Edit > Edit Colors > Adjust Color Balance to adjust values. To sharpen an embedded image, choose Effect > Sharpen > Unsharp Mask (which is the same unsharp mask filter from Photoshop).
Of course, you'll always have more powerful controls over your images in Photoshop. To edit an embedded image in PS, copy it from AI, switch to PS, create a new doc (it will create the file at the same size of the image you have on the clipboard) and paste as pixels. Then save the PS file. Some folks don't realize that even though you can't perform an Edit Original on embedded images, you CAN perform a Relink function, which remembers scaling, position, rotation, etc. So back in your AI file, open your Links panel, select the embedded image and click the Relink button. Choose the new file and it will pop right into place.
Let me know if these things work for you.
Mordy-
Thanks, those are some great ideas I'll have to try out. We don't have CS3 yet (IT is saying they will roll that out in our office in the next few months.) Will those filters work in CS2? I'll try that out tonight. And the relinking sounds like it would take out half the work time. Thanks!
-Wes
Hate to be a hog here but I just found something neat that I'd like to share. On the first option of Using A Mask you can get a neat "window" effect by going to Stylize>Scribble (play with the settings) and you get cool "revealed" images as the scribble applies over the entire frame. Set blend mode to different settings too. Even apply a second frame by adding a new stroke from Appearance Panel.
I often here of limitations to Illustrator but the sky seems to be the limit with all the tricks and tweaks you can apply. WOW!
Mordy, Ignore my question on jagged images in Illustrator.
We got this figured out (see Illustrator Techniques Forums). I was using blended-"gradient" art brushes. As these are blends they are muliple objects which when stretched over a long distance separate or band like gradients do to give the jagged/ragged edges. If saved as jpeg, gif files or in Photoshop they get smoothed transitions so actually look good. They do not save out well as ai, or pdf files though.
Cheers, Gary.
Mordy - more an InDesign question but related to techniques in Illustrator.
When creating dashed strokes in InDesign, on a perfect ellipse, there is a point where two of the segments of the gapped stroke overlap or are close (not evenly spaced like the rest). I think the problem can be solved in Illustrator by cutting the path with scissors? Not so in InDesign. Any leads on this issue?
Aha- on that last question. It is a matter of stroke width/size to overall shape dimensions. When I reduced the stroke size it eliminated the problem. Still any thoughts on this issue of stroked paths in Illustrator or InDesign would be of use and interest to many I hope.
I just want to stick up for 1pt strokes everywhere. You're all beautiful in your own special way.
Great brief answer Mordy, I really admired with your attitude towards answering questions, not everyone have this. I would like to take animation as my profession, since I'm already in the business I can't go computer classes. So could you please guide me some of the basics books for designing(Photoshop, etc.,) to Animation(Flash, Maya etc.,). I'm eagerly looking forward to you answer...
Car Breakdown
Dear Mordy,
I have a question that my exhausted mind cannot answer. I have already sliced and diced a multi-layered AI document (some graphic designer had a ball making this one). The graphics look great in Dreamweaver, and I am learning CSS as I do this (for me) complicated website. My problem is how do I now add the text to the slices? I created divs for the slices and I'm thinking I must nest some paragraph divs but don't want to stay up all night again trying to deal with this layout and do it the wrong way.
Thanks, and next time I will just use the html as you taught us.
Jeanne
Jeanne, you don't need to create a nested DIV just to add text -- you can just add the text directly -- and use additional CSS styles to control the appearance of that text. You're doing everything right!
Maybe head over to tv.adobe.com and search for CSS and text and you'll find some great free video tutorials on how to do this.
Good luck!
:) Mordy
Mordy,
I must not understand slices yet. I have them in divs and you say I can just add text to them once they are DWCS4, but I cannot. I don't want the text with graphic backgrounds that I sliced to be in jpg format (seo purposes, etc.)so I need to layer it over the slice I added to DW. I am very confused. Jeanne
You want the sliced images to be the background of the DIV (not the contents of the DIV). You can do this easily in DW.
You must have sent me this information via ESP because I discovered that just before I read your response! Yeah! Thank you, Mordy.
Jeanne
This is a godsend! I've been working with Illustrator for my job for a few months now... I always have to add images [with transparent background] to my work, and I've finally found an easy way to add strokes to them. Thanks!
THANK YOU!!
Post a Comment