Inkscape.org
Beyond the Basics Making tile borders pixel-perfect when exporting as png
  1. #1
    apmbcn apmbcn @apmbcn

    I have created a 64x64 pixel isometric tileset in Inkscape where the borders of all tiles align perfectly with each other, i.e. the cusp nodes at the border of one tile are at the same location as the cusp nodes of the corresponding border of the next tile. The problem is that because the tiles are isometric, some of the pixels at the borders are partly translucent, i.e. their alpha is below 100% (see attached translucent_tile_borders.png and zoom in). This makes the tiles look like they have holes between them (and within them, because the tiles have internal borders too). When I create a sample terrain with the tiles, the holes are noticeable.

    I need the tiles to be pixel-perfect, i.e. to align perfectly at the borders after being converted to raster graphics, or at least to not have any holes between them (a small bit of overlap is acceptable, but not if I do it by expanding the tiles in Inkscape so that they overlap - they each need to fit into a 64x64-pixel-sized square). In theory, all the png exporter needs to do for them not to have holes is to avoid sampling from the background when determining the color of the individual pixels (so that it only samples from paths) if any paths exist to be sampled from. How can I set it to do that, or what else can I do to eliminate the holes?

    Also, on an unrelated note, is there any interest in my hosting the base tiles (geometric primitives) I designed into this site's galleries for people to make their own isometric tilesets with? See baseline.svg for the contents. It's a work-in-progress but will have both two-layer (length = 2 * height) and one-layer (length = height) tiles.

    Translucent Tile Borders
    Baseline
  2. #2
    apmbcn apmbcn @apmbcn

    I've just realized I can fix the transparency issue by having a script set the alpha value of every pixel to 100% if that pixel's alpha value is already above 0%. Unless Inkscape is doing something like making transparent pixels black underneath the transparency, this should work. Even if it doesn't, I can always interpolate the pixels to have values averaged between those of the adjacent fully opaque pixels.

    Can I somehow make the script fire immediately after Inkscape is done creating the PNG image? Is there a hook provided for that?

Inkscape Inkscape.org Inkscape Forum Beyond the Basics Making tile borders pixel-perfect when exporting as png