I'm trying to create an 8bit cave image in Illustrator for a fun little 404 page but am having trouble on export. The file in Illustrator looks like this screenshot:
However, when I export the image as a png, I see white boxes around each pixel of the image:
I exported the image as svg as well, and the white boxes also appear there. It seems like that's because each of the rect
elements has a slight bit of space between them:
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 692 466">
<defs>
<style>
.cls-1 {
fill: #ffebb2;
}
.cls-2 {
fill: #ebd798;
}
.cls-3 {
fill: #cbb076;
}
</style>
</defs>
<title>cave</title>
<g>
<rect class="cls-1" x="681.97" y="455.87" width="10.03" height="10.13"/>
<rect class="cls-2" x="671.94" y="455.87" width="10.03" height="10.13"/>
<rect class="cls-2" x="661.91" y="455.87" width="10.03" height="10.13"/>
<rect class="cls-2" x="651.88" y="455.87" width="10.03" height="10.13"/>
<rect class="cls-3" x="641.86" y="455.87" width="10.03" height="10.13"/>
{...MORE SVG...}
I believe I could fix this problem with some scripting by giving each rect element a nice integer height and width and then 'snapping' each of those rects to a perfectly round position on the x, y axis. I would much prefer to fix the problem in Illustrator however, as I want to get better at it.
Does anyone know how I can remove the white boxes that surround each rect element in the exported svg? I tried Object -> Make Pixel Perfect
but that made even larger white boxes around the exported rects. Any help others can provide would be very helpful!