Inkscape.org
Beyond the Basics How can I render black+white (1-bit) bitmaps as colour+transparent?
  1. #1
    bitrat bitrat @bitrat

    Hi,

    in the CorelDraw version I used in the late '90s*, black and white (1-bit) images were imported, by default, as black with a transparent background ('white' being the background or 'paper' colour).  This was stratospherically useful and convenient.  Even more brilliant and amazing was the fact the the default 'black' could be rendered as an arbitrary RGB colour, by setting the pen attribute of the image.  I have no idea what CorelDraw does now, if it exists.  I seem to remember it was acquired and 'improved'.

    In Inkscape, black+white bitmaps are rendered, somewhat prosaically by comparison, as black and white.

    Please, please, please tell me there is a way to render 1-bit bitmaps in Inkscape as colour+transparent.  If not, I'll lodge a feature request.

    On a related topic, if there are any GIMP experts out there, I have failed to find any way to produce a black+transparent (1-bit) PNG file using this package.

    I've used this method, which nearly works:

    1. create a black and white thresholded image with redundant bit width (RGB or grayscale)
    2. add a layer mask
    3. copy bw image to layer mask
    4. fill image layer with solid black
    5. convert to 1-bit indexed image mode [ Image | Mode | ...Indexed -> Use black and white (1-bit) palette ]

    Unfortunately, although I ask for a 1-bit palette, the result is an antialiased 8-bit palette.  (I'd call this a bug, because I'm not prevented by GIMP from selecting the 1-bit palette.)

    I wonder if it would be possible to trick Inkscape into rendering a black+white bitmap as colour+transparent by editing it's SVG representation.  If so, would this survive reimporting and then render in colour in the GUI?

    Finally, I've had the following issues with exporting Inkscape drawings with bitmaps to PNG:

    • 1-bit bitmaps are antialiased in the rendered file.  This may have to do with resolution.  If possible I'd like to have a pixel by pixel mapping from the image in the drawing to the exported image, and would appreciate any advice on this.
    • Transparency in imported bitmaps is rendered with a checker pattern in the exported PNG.  This is probably my fault, and I'm not sure if it always happens, but I'd appreciate any advice on that as well.

    Sorry about this rather long winded inquiry.

    Cheers, bitrat

    * yes, Virginia, there is a Santa Claus.

     

     

     

     

     

  2. #2
    bleke bleke @bleke

    Regarding antialiasing, have you tried pixelated rendering in Object Properties?

     

  3. #3
    bitrat bitrat @bitrat

    No I haven't, thanks!  I'll give it a whirl.

  4. #4
    bitrat bitrat @bitrat

    @bleke thanks for this.  crisp-edges works for me, but I'm not sure yet how this differs from pixelated.

     

  5. #5
    bleke bleke @bleke

    I'm not sure either... I guess crisp-edges is supposed to have antialiasing when you rotate pixelated images? They look the same to me though.

    https://stackoverflow.com/questions/20678639/image-rendering-crisp-edges-vs-pixelated

Inkscape Inkscape.org Inkscape Forum Beyond the Basics How can I render black+white (1-bit) bitmaps as colour+transparent?