0

I have created a grid with just basic lines in illustrator and saved as SVG. I then am loading that svg into a html canvas of exactly the same size as the svg.

However no matter what i do the black lines on the canvas svg look grey, in fact the odd one or two is black, but the others look like they are being anti aliased.

I don't want the canvas to do that, i need the lines sharp and black, not grey! They look fine in illustrator, after i turned off anti-alias.

Does anyone know how to prevent the canvas doing that? I am using fabric js

Glen
  • 455
  • 3
  • 14
  • 28

1 Answers1

1

You can turn off anti-aliasing by using the following property:

shape-rendering="crispEdges"

It can be a style attribute, or you can specify it in CSS. You will need to edit the svg, or your CSS. You can't set this in Illustrator.

This will work fine for rectangular grids, but curved or angular lines will look worse. of course.

You can also avoid anti-aliasing by being careful where you place your lines. See the following answer for more info on that.

https://stackoverflow.com/a/23376793/1292848

Community
  • 1
  • 1
Paul LeBeau
  • 91,047
  • 8
  • 141
  • 167