Exporting as 1bpp BMP

Post questions on how to use or achieve an effect in Inkscape.
beneficii
Posts: 9
Joined: Sun May 25, 2014 8:13 am

Exporting as 1bpp BMP

Postby beneficii » Thu Oct 29, 2015 11:38 am

It seems that the latest Inkscape really restricts your export options. I have a number of SVG images that need to be exported to monochrome bitmaps of various sizes. The requirement for there to be various sizes is why I used Inkscape in the first place to create images. Unfortunately, even though the SVG images themselves only use full-on white and full-on black, when they are exported as PNG a lot of greys get added in what I guess is an anti-aliasing process, which is fancy but too complicated for my needs.

Do you all have any tips to get a 1bpp BMP? Should I make the SVG images a certain size and then do Print Screen?
Attachments
championwhite.svg
(3.01 KiB) Downloaded 260 times
championmask.svg
(3.01 KiB) Downloaded 255 times
championblack.svg
(3 KiB) Downloaded 298 times

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Exporting as 1bpp BMP

Postby Moini » Thu Oct 29, 2015 11:58 am

Hi beneficii,

- install imagemagick, a tool for command-line image conversion, that also has a batch conversion mode (http://www.imagemagick.org)
- export your your drawing to pngs in different sizes as normal,
- then do this on your command line (if it doesn't work as expected, take a look at their website to fine-tune the options, especially to set the threshold, might involve an additional step):

Code: Select all

convert -colors 2 -depth 1 truecolor.png 1bpp.bmp


- or, if it's more than one image, and they are all in the same directory, try the batch mode:

Code: Select all

mogrify -format bmp -colors 2 -depth 1 *.png


Edit: also take a look at these options:

Code: Select all

-type bilevel -alpha off

in case you need them.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

beneficii
Posts: 9
Joined: Sun May 25, 2014 8:13 am

Re: Exporting as 1bpp BMP

Postby beneficii » Thu Oct 29, 2015 12:30 pm

Thanks. Unfortunately, for the smallest bitmaps, it still looks messed up. The smallest is 21x21 pixels.

I tried turning anti-aliasing off in Inkscape 0.91 for the document, but turning it off does not seem to apply to exported files.

I'm going to try another option which is to import the SVG into GIMP and set the resolution. I am told turning off the anti-aliasing will work with that.

Nevertheless, if I cannot save 1bpp BMP files with GIMP, I will definitely use mogrify again.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Exporting as 1bpp BMP

Postby Moini » Thu Oct 29, 2015 12:35 pm

(does it work if you do the resize in imagemagick instead? - just because it could be faster)
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

beneficii
Posts: 9
Joined: Sun May 25, 2014 8:13 am

Re: Exporting as 1bpp BMP

Postby beneficii » Mon Nov 16, 2015 6:53 am

The BMP's produced by imagemagick could not be loaded using the Windows API function LoadBitmap(). What I do instead is load the SVG in Gimp with the correct dimensions and then copy and paste the image to MSPaint. It's lengthy work, but it pays off.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: Exporting as 1bpp BMP

Postby Moini » Mon Nov 16, 2015 7:03 am

I'm glad you found a way to make it work - even if it's not exactly comfortable...
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)


Return to “Help with using Inkscape”