I called Adobe 4 days ago or so and they are still working on the problem but I am posting to see if anyone else can help. Simple explanation of what is happening, I made a 32x32 pixel box, put a 32x32 artboard around it, export it at 72 ppi png, with or without antialiasing which doesn't seem to matter whether it's on or off, yet it always exports out as a 33x33 png instead of a 32x32, adding 1 pixel to each side, tested with a higher resolution, doesn't matter saves with 1 extra pixel on each side example 500x500 will become 501x501, when I look at the picture even if it's a solid color square it will make the edges transparent and ruin the picture on the edges making it hard to fix in another program after exported from illustrator. I tried something out when I searched the internet for solutions, I checked in save for web under Image Size it will say my 32x32 square is 33x33 in that screen but in the info window it is 32x32. This problem never happened to me a week or 2 ago, I have been using Illustrator for a couple years now. Any help would be really appreciated.
I have align to pixel grid turned off if that matters at all.
- Patrick Daniels
ps random question, sometimes when I am typing in the width and height in the transform window changing the size it was previously, example from 67.354 W to 67 and 55.271 H to 55, instead of going to 67x55 it will change itself to 67.18 and 55.084 that is an example not from an actual thing I did. But it just confuses me why it does that.
I made a few tests and I confirm the problem - apparently a weird bug. I found that if the first export in a document session is to png either by File > Export or Save for Web with png selected when Save for web opens, it adds a pixel on each side, then exporting to jpg also adds a pixel. But if you first export to jpg the size is exact and if after that export to png the size is exact too. At any time and situation using Save for Web and Devices, in the image tab, correct the size and it will be exact.
I just tested this and got the same results with save for the web and with export to png but if I make an artboard the exact size of the art it will in fact read as the correct size and when opened in Fireworks he same size if I choose clip to artboardd.
33 is adding the size of the stroke, plus more if the art does not align with the pixel grid
do this first, if you have a stroke, remove it or align it to the inside
or go to View->Pixel Preview to turn the grid on, you can actually count the pixels before you export. If previous step didn't fix the square to 32, then click on "Align to pixel grid" in the transform palette.
I am happy you were able to recreate the problem. I was excited to read that you found a way around it, but I tried to do as you instructed and it didn't work for me.
Tried loading an illustrator file I had already and exporting as a jpg first, the jpg still added an extra pixel but instead of 33x33 it was 33x32 when I wanted to achieve 32x32. I even tried closing Illustrator and creating a brand new document. I also a few days back deleting all the Illustrator settings which didn't fix the problem.
Here is an image of the different sizes. I never use Save for Web but found it shows what the image size will be and how the image will look, so I am showing this as an example. That should be a perfect red square, no anti-aliasing, the edges should be red and not a lighter tint of it, I turned off transparency also and it just leaves a lighter shade of red there, but I put it back on since it didn't matter.
The Image shows that the artboard is 100x100 and the square is 100x100, but in the save for web, I have it there to show that it is showing it as 101x101 and distorting the edges(The top red square is the png one).
Try what Carlos suggested, in your transform panel "Align to Pixel Grid" is not checked. Check it and try again. May be this is the problem and Illustrator is not smart enough to do it on its own.
I tested your way out, it fixes the problem, but it also reminds me why I turned off the pixel grid.
I switched my stroke to be in the inside of teh square, the artboard will go around it and save it fine, but it shifts the graphics and after I switch the stroke to the inside is when I can apply the artboard, if I switch back to stroke to center it will ruin the exported image and the stroke will not be perfect.
Also with the Pixel Grid on, it always messed up my graphics that were in groups relocating them so I would have to manually go in zoom and fix the positioning, example when I create custom shadows/highlights. This happens using the align tools.
I also noticed that the x and y coordinates of your object are not round numbers to fit easily the width and height in the pixel grid. When the coordinates are not round numbers if you go to View > Pixel Preview you will see anti-aliasing