Variation in exported image size based on coordinate position when using Asset Export
I think I'm seeing a bug in the size of an exported image when using Asset Export for Illustrator v27.5 on Windows 10 22H2 19045.3803. Here's what I've done and the result I'm seeing:
- Create a new empty document, I used an artboard size of 60" x 36" with coordinates (0", 0")
- Add a square to Layer 1 sized to 5" x 5" with a position of (10", 10")
- Create a new layer, Layer 2
- Add another square to Layer 2 sized to 5" x 5" with a position of (30.5", 20.5")
- Select Layer 1 and Layer 2 in the Layers menu
- Then select Collect for Export
- In Asset Export, change the export settings to scale to a resolution of 25 PPI as PNG
- Then export
I had expected I would get 2 images each with dimensions of 125 x 125. Instead, I get one image at 125 x 125 and the other image at 126 x 126.
This seems like a bug where the export is rasterized based on the artboard coordinate system instead of the asset's relative coordinate system, which can result in fractional dimensions that round up. Is it possible to get a bug fix for this or is there a newer version of AI that has this fix?
-
Zoe commented
I am sure there is a technical reason as to why this bug occurs, but the fact of the matter is that if I ask Illustrator to export something as 256px, it should export as 256px. Full stop. No ifs or buts. I shouldn't have to magically divine the correct coordinates or make my work 1px smaller than intended. Please fix.
-
Chris commented
@Ton Thanks for trying to help. I think we can all agree that fixing the bug should be a priority for Adobe. Letting this bug exist for 7+ years is embarrassing.
-
Ton commented
Chris, we are not Adobe engineers. I tried to explain what is happening. I know that the current way of creating pixels can be improved, but I (and Egor) cannot change that. In the meantime there are only workarounds. The bug report is from 2017, but the problem existed before. Let's hope that this gets more priority.
-
Chris commented
@Egor I'm not looking for a workaround, I'm looking for the bug to corrected. I happen to be a computer graphics software developer myself. If your/Ton's explanation of Illustrator's rendering implementation is correct, then the rendering implementation itself is incorrect. Vector graphics should not be dependent on an underlying pixel grid. Instead, they are geometry that exist in 2D space and then the Illustrator window, the artboard, or an asset export are the viewport through which we view, sample, and rasterize them. If my viewport is an integer size of NxN and then I render it scaled at integer SxS, then the output dimensions will be integers NSxNS, not NS+1. It doesn't matter whether you super sample or not.
Imagine applying your logic to 3D graphics where the viewport is defined by a camera and the output dimensions are defined by the frame size. Your bug is that as the camera moves the dimensions fluctuate every frame. Clearly, that's not correct.
My expectation for a bug fix is that the output dimensions of an asset or artboard do not fluctuate based on coordinate position or anchor point, just based on their dimensions. Of course, assets or artboards with a decimal dimension (width or height) will round up 1 pixel.
-
Chris, Ton has given a perfect explanation of what is happening exactly.
150 hardly divides by 72 without a remainder, so rounding occurs. It just HAS to be rounded... :(
The problem still persists. I have no other workarounds to offer except the tedious rearranging to fit the assets into the grid. Sorry! -
Chris commented
@Egor Thank you! Yes, these artboard and asset export issues are basically the same problem. Also, for a little further context with my example, if that 5"x5" square is placed at (10.5", 10") then exported at 25 PPI, the resulting image is a rectangle of 125 x 126. It's not even a square anymore.
It sounds like you understand the problem very well, but please let me know if there is any way I can be helpful to get this issue resolved. I'm happy to provide further files or additional information.
-
Ton commented
Chris, as long as you use 72 ppi as output resolution and artboards and objects align to the pixel grid you will see no additional pixels.
Changing the output resolution to something other than a multiple of 72 ppi can generate additional anti-aliased pixels caused by rounding.
With your example of a 360 pixel sized object at 25 pixels per inch you would expect an image of 125 pixels (360/72 = 5 and 5X25 = 125).
You will get that when the upper left coordinates of the object can be divided by 72 and the result does not contain fractions. This happens with individual assets on a single artboard, as well as objects on multiple artboards.
If you space the artboards 72 pixels apart you get the expected pixel size.
I think that the behaviour of rounding fractional pixels can certainly be improved (I would prefer rounding down) but this explains what is happening.I see Egor already pointed to the bug report on UserVoice
-
There is a related problem, with exporting artboards in general:
https://illustrator.uservoice.com/forums/333657-illustrator-desktop-feature-requests/suggestions/30992416-wrong-exported-image-size-extra-pixel-added-if-a
But while a general advise to place artboards on a grid works (in *some* cases), with assets it’s just stupid.
I do realize why this behavior happened to be, and I can imagine cases when it can be important... but in a majority of cases the raster grid should be local, yeah.