March 12, 2008

Of document sizes and crop areas: A bedtime story about Save for Web & Devices

I've often seen questions about Illustrator CS3 and the Save for Web & Devices feature. One common question is, "Why do my colors look rich and vibrant in my Illustrator document, but less-than desirable in Save for Web?" I won't answer that question in this post (but it has to do with the fact that CS3 now defaults to using the sRGB color space when exporting from Save for Web), but I'd like to deal with yet another question that I see frequently.

You may find that at times, when trying to use Save for Web & Devices, you'll get an error dialog that says "The image exceeds the size Save for Web was designed for. You may experience out of memory errors and slow performance. Are you sure you want to continue?"



This "issue" is caused by some new behavior that was introduced in Illustrator CS3 around the implementation of document size settings and how crop areas work. Let's take a closer look inside, shall we? Then we'll see how easy it is to fix this little problem.

In a previous post, I spoke about some of the changes to the settings in Document Setup as they pertain to NDPs (New Document Profiles). Specifically for new documents created with the Web profile, it's important to realize that Illustrator creates a document size of 14400 x 14400 pixels in size, and creates a crop area at the size you specified in the dialog (i.e. 800x600). I also mentioned that the profile specified in the file's metadata "tells" Illustrator to honor the crop area size as the document size, so things like printing and zooming to fit in window function as one would expect.

But this really is an important concept to understand. If you create a new 800x600 Illustrator document, using the Web NDP, and you zoom out to like 4%, you'll see the huge document size, and the crop area in the center.



By default, the Save for Web & Devices feature uses your crop area as the boundary for your artwork. This is actually a great feature, as you can easily dial in a specific size for your web graphic and get exactly what you expect (without this, you can often get image sizes that are one pixel off, or have extra white lines, etc). With the new crop area functionality in Illustrator CS3, you can create multiple crop areas, making it easier to quickly export multiple web graphics from a single Illustrator document. For example, I often have several web banners set up in a single Illustrator file, with multiple crop areas defined for each banner (only one crop area can be active at any one time, though).

So to come full circle on all of this, when you create a document that is 800x600, a document size of 14400x14400 is created, a crop area of 800x600 is created, Illustrator considers the crop area as if it were really the document size, and when you export your artwork using Save for Web & Devices, the artwork is cropped exactly to your 800x600 crop area.

HOWEVER, there is a setting in Save for Web & Devices that can change all of this Well Thought Out Logic.

When you open Save for Web & Devices, there's a group of three panels on the far right, beneath all of the image format and optimization settings. These panels, Color Table, Image Size, and Layers, provide additional functionality, which can be very useful. But for the sake of this post, we'll focus on the Image Size panel.



In this panel, you can see the exact size of your final image and even change it. I often do this because Illustrator artwork is of course, scalable to any size. So if I need to create a graphic set to a specific size, I can do that MUCH faster here in the Image Size panel than actually resizing the art on my Illustrator artboard for each size I need. You can just dial in the settings (and remember to hit the Apply button). But there's also an all-important setting here -- a box labeled "Clip to Artboard". This setting, when checked, instructs Illustrator to ignore the crop area size in your document, and instead uses your document size as the final size for your web graphic. So going back to what we now know about how Illustrator sets up a Web document, let's see what this means.

Using the same settings in my example above, if you turn on the Clip to Artboard setting in the Image Size panel, you're telling Illustrator not to export an image of 800x600 pixels, but rather an image of 14400 x 14400 pixels. That's just "slightly" larger in size, right? Since web graphics are never that large, Save for Web was never designed to work with images at that size and hence, the error dialog appears. So if you're getting the error, it simply means that the Clip to Artboard setting is checked on. This could happen quite easily, because the settings in Save for Web & Devices are "sticky" -- meaning settings stay as you set them, even as you move from one document to another.

So the question is, how to fix this problem? Well, obviously, the solution is to open Save for Web & Devices, click on the Image Size panel, and uncheck the Clip to Artboard option. However, there are times when Save for Web & Devices won't even open, as it will close the window immediately after you dismiss the error dialog. The solution then is to first choose File > Document setup, and specify a much smaller Width and Height for your artboard (something like 1200x1200 for example). Once you do that, you'll be able to open the Save for Web & Devices feature without error, and you can then uncheck the Clip to Artboard option.

28 comments:

Anonymous said...

Illustrator's implementation of slices is so horrid I've simply gotten into the habit of exporting to Photoshop and using its "Save for Web" instead.

Suki said...

Awesome, solved my problem.

But why is default document size so large?

Thanks,

-Cre81ve

Unknown said...

Who said anything about slices? I use S4W all the time from AI just to export entire artwork as one image.

But since you did bring up slices, yes, the implementation in Illustrator leaves something to be desired. But that's just because people try to use it in the same way as they do in PS -- but it can be quite useful for a variety of things. I actually just used it today...

Glad I could be of help, Suki :)

Unknown said...

I use slices in Illustrator all the time, too - mostly without problems. But every once in a while they start acting like a classroom of unruly first graders, and just cannot be made to do what their told.

But that's not the subject of my comment.

I've gotten into the habit of appending the pixel dimensions of a graphic to its name when I Save for Web. But just when I'm ready to create the file name, I find the S4W settings is set for the Color Table tab by default. I have to cancel my save, click the Image Size tab - so now I can see the dimensions - and return to Save.

All things considered, don't you think the Image Size tab should be showing by default when you invoke S4W?

Anonymous said...

Well I don't really think it's entirely unreasonable of a user to assume that a given feature which presents a nearly identical interface across a given vendor's implementations will function in a nearly identical manner. Adobe certainly agreed with that logic when it came to their text engine and color management settings. Though the latter is still very much a work in progress, someone is clearly working on it.

The problem I have is that "Pixel Preview" is never an accurate representation of what "Save For Web" will generate, making the actual positioning of one's slices (or even basic crop areas) something of a crapshoot. Someone's anti-aliasing invariably gets chopped incorrectly, leaving you with gaps and/or awkward looking borders when reassembled on the page.

I've also never seen how to go about naming slices in Illustrator, so it just spits out an incomprehensible mess of files I have to go through and rename manually each time I save. There might actually be a way to do this that I've simply been too lazy to look for, but Photoshop's approach is arguably more intuitive, and it's one that Illustrator *could* adopt if it wanted to.

So I just pretend that Illustrator has no "Save For Web" feature at all and things tend to come out the way I want them on the first try. Adobe wants to solve every web developer's problems with more Flash these days, leading them to neglect features like these which actually matter. I'm not sure when they're going to realize that the vast majority of web developers rejected Flash in favor of standards and indexable content ages ago and stop wasting time integrating it into every facet of everything (no Mr. Nack, nobody wants a Flash enabled web browser embedded in an application splash screen regardless of whether or not it's full of spyware from your PR department), but it's going to have to happen sooner or later unless the only users they want to keep are wedding photographers and industrial designers. Those people don't think a web page is done until everything on it moves continuously and makes a lot of noise, so it's a match made in heaven.

Без BMW в Минске said...

I use Illustrator CS and very enjoy this program. I want buy BMW when get a lot of money on my work in Minsk (Belarus).

Anonymous said...

How wants to see my own site logotipe? I make it in Corel... It so cool :)

Anonymous said...

This is real mad action & active web life.

Anonymous said...

Hi there,

I am wondering if there's an equivalent of Firework's Trim Canvas in Illustrator CS3. It works like this. If I have a 1024 x 768 Canvas/Document Size in Fireworks, I can draw a small square the size of 24px X 24px and then do a Modify > Canvas > Trim Canvas. It will trim the canvas/document size to 24px X 24px.

I am so used to this feature in Fireworks that I wonder if there is an equivalent in Illustrator CS3 and if it's easy to do?

If I create a square 24px X 24px in Illustrator and copy+paste that square on top and then do a Crop Area and export it as PNG or others - that works fine.

But I want it to be precise especially if the icon shape is not exactly square or rectangle. Like 23.451px X 24.521px.

Hope you can help. Thanks.

Unknown said...

Luna, you can use the method you describe to create and position crop areas numerically -- very precise. But I do have a question for you -- how is it physically possible to create a fraction of a pixel?

Anonymous said...

"physically" possible to create a fraction of a pixel?

hmm....

Anonymous said...

Mordy, thanks for the reply.

I am referring to the W X H of an odd-object. Usually it shows something like W: 21.45px and H: 37.992px. What I usually do is create a rectangle on top of that odd-shape object. Copy the X,Y,W,H of the odd-shape object and apply it to the rectangle so that it's precise before exporting it as PNG. If I open the exported file in Fireworks, the W X H is rounded up like this ... W:21px X H:38px.

My question is simple - just wondering if is there an easier way, a single button click, that is similar to Fireworks' Trim Canvas feature in Illustrator CS3?

And to your question : dont really get you. My example is a reference to the W,H,X,Y feature in Illustrator, seems like very precise as it doesnt round up the value.

Anonymous said...

Close your eyes, luna
And I kiss you
Don't worry, baby ) I miss you
Remember I always be true.

Unknown said...

khiltd ... well said. users should expect the functionality to be essentially the same across products, and Adobe is foolish for changing the feature so drastically.

However, i'm having another problem. I'm trying to crop outside of the "crop area" (not the 14,000x14,000 default artboard size, but my own set crop area of 900x800).

Essentially, i'm trying to slice my x-repeating background, which I have never had any trouble doing in illustrator. This background gradient, obviously, is larger than the crop area size.

Now that Adobe has implemented this "crop area" feature, every time I try to crop anything outside of my crop area, the save for web tool will not crop it to my specified size. I have even tried deleting the crop area and sizing my artboard back to my original size of 900x800px.

Any ideas?

terrablue444 said...

I was having trouble moving my slices around and was experimenting (i.e. clicking random buttons). This is where I stumbled upon the "Clip to Artboard" option in the Slice menu.

This created alot of headaches, and Im so glad to have found this post! Long story short, experimenting is good - but only under adult supervision

Unknown said...

You could create a second crop area -- one that is larger than the first. Switch to the larger one when exporting your repeating background and go back to the smaller one for other times. Does that work for you?

Anonymous said...

Mr Mordy, T H A N K S!

You´re great! I read de silly explanation on AI CS3 docs about crops and... no, no, no...

So, T H A N K S again...

Time saving tip.

Anonymous said...

Great post Mordy!
I was getting the thin hairline pixel offset border problem on my slices and "clip to artboard" helped me figure out my problem as it was perfect with it deselected. ...turned out the x,y co-ordinates of my artboard were slightly off. i.e. there is no snap to pixel when moving an artboard around. ...I'm referring to CS4 here of course.

donna panda said...

oooo thanks a lot! this was a bis mistery! haha
Now is fixed! one day, maybe, i have the certificate... thanks!
kisses from braziL!

Manuel Colombo said...

Mille Grazie!!!!
mi hai salvato la vita!!!

Thanks, you saved my life!!!

Anonymous said...

Thanks! You helped me save a lot of time!!

Solla said...

Hi Mordy

Re: "The image exceeds the size Save for Web was designed for. You may experience out of memory errors and slow performance. Are you sure you want to continue?"

Thanks for this post, but I have a question anyway...
I am working in Illustrator CS4. My artboard is 700x700 in px (a print document though). I want to save it as a big jpg file. In Save for Web & Devices I change the size to 4000x4000px and hit "Apply" and I get the error dialog regardless if the "Clip to Artboard" is checked or not. So I continue to save anyway and a jpg file is created.

So my question is, was it ok to ignore the warning since I was able to save? - The file opens up ok in Preview and my browser for instance...

Unknown said...

The warning is just there to let you know that something bad *may* happen. But if the export succeeds, the file should be perfectly fine.

Anonymous said...

woo hoo!

that little "crop to artboard" tick box was what i was looking for. this post helped me find it.

much ta!

Diseño web said...

Freaindly toturial. Simply and easy. Congrats!

CharityGrace said...

you are awesome! thanks so much 4 years down the line from when you wrote it.

Anonymous said...

This is the solution I was looking for. I was getting an Illustrator crash and freeze whenever I tried to Save for Web. So now I just make sure that I have selected the right artboard and then it doesn't open the 14400 x 14400 monster and works like a charm. Alhamdulillah. :)

Kat said...

Another reluctant CS3 user (I have CS6 for freelance work, but my FT employer has CS3) saved by this write-up! Still relevant and much appreciated :)