Tileset exports with translucent colors after upgrading to v1.3-rc2

Hi,

I just upgraded to v1.3-rc2

This script is now producing tileset .pngs with translucent colors for some reason

        local scale = 1
        local spec = spr.spec
        spec.width = size.width * scale * tilesPerRow
        spec.height = size.height * scale * ((#tileset // tilesPerRow) + 1)
        local image = Image(spec)
        image:clear()
        for i = 0, #tileset - 1 do
            local tile = tileset:getTile(i)
            tile = tile:clone()
            tile:resize(grid.tileSize.width * scale, grid.tileSize.height * scale)
            local drawTileX = (i % tilesPerRow * grid.tileSize.width * scale)
            image:drawImage(tile, drawTileX, i // tilesPerRow * size.height * scale)
        end

        tileset_n = tileset_n + 1
        local imageFn = tileset_path
        if not image:isEmpty() then
            dgUtils:log("Color mode values: indexed: "..  ColorMode.INDEXED .. " rgb: " ..  ColorMode.RGB )
            dgUtils:log("Exporting tileset image in color mode " .. image.colorMode)
            image:saveAs(imageFn)
        end
        t.image = imageFn

Git comparison of the export before and after upgrading (no script change)
Maybe I did something wrong but I don’t think i even changed this tileset since upgrading

1 Like

Hi @dogboydog,

I haven’t tested to be sure, but I know that the function signature for Image:drawImage was recently changed, so that’s where I’d start debugging.

I’m wondering: Is one coordinate being interpreted as opacity? If so, maybe start by putting the x and y into a Point object.

2 Likes

Thanks, that’s it. Changing to
image:drawImage(tile, Point{x=drawTileX, y= i // tilesPerRow * size.height * scale})
did the trick.

2 Likes