mkbitmap(1)
β¨ mkbitmap β the glow-up your images have been waiting for β¨
okay so bestie, this is mkbitmap(1) from the General Commands Manual section, and it is literally the makeover artist for your pictures. π
πΈ NAME πΈ
mkbitmap β transform images into bitmaps with scaling and filtering π¦
π SYNOPSIS π
mkbitmap [options] [filename...]
π DESCRIPTION π
so here's the tea: mkbitmap reads an image and then applies one or more of the following operations to it, in this exact order: inversion, highpass filtering, scaling, and thresholding. every single one of these can be individually controlled and turned on or off. no cap. π₯
the main character use of mkbitmap is converting color or greyscale images into a format that's suitable as input for other programs β especially the tracing program potrace(1). it's particularly iconic for converting scanned line art (cartoons, handwritten text, etc.) into high-resolution bilevel images. it's giving scan-to-slay. β¨
highpass filtering can be used to make sure foreground features like lines and text are preserved, while also compensating for uneven background. optional blurring can be applied to smooth out the image and remove visual noise. scaling matters because a scanned greyscale image contains more visual detail than a bilevel image at the same resolution β by scaling the image to a higher resolution (using interpolation) before thresholding it, some of this detail is preserved. thresholding means converting a greyscale image to a bilevel image using only black and white pixels; pixels that are darker than a certain threshold value get converted to black. optional inversion is useful if the input image shows bright features on dark background, like a picture of chalk drawings on a blackboard. π¨
supported input formats are PNM (PBM, PGM, PPM) and BMP. the output formats are PBM for bitmaps, and PGM for greymaps. periodt. π
β¨ OPTIONS β¨
π«Ά General options:
-h,--helpβ print help message and exit. your lil helper bestie.-v,--versionβ print version info and exit. π-l,--licenseβ print license info and exit.
π Input/output options:
filenameβ if filename arguments are given, thenmkbitmapwill by default create one output file for each input filename given. the name of the output file is obtained from the input filename by changing its suffix to.pbmor.pgm. if the name of the input file and output file would be identical, then an additional suffix-outis appended to the output filename. if no filename arguments are given, thenmkbitmapacts as a filter, reading from standard input and writing to standard output. a filename of-may be given to specify reading from standard input; the output for this argument will then be written to standard output. each input file may contain one or more images. π-o filename,--output filenameβ write output to this file. all output is concatenated and directed to the specified file. this overrides the default behavior of creating one output file for each input file. a filename of-may be given to specify writing to standard output. π¦
πΈ Image processing options:
-x,--nodefaultsβ turn off default options. normally, the following options are preselected by default:-f 4 -s 2 -3 -t 0.45. the-xoption disables these defaults; thus,mkbitmap -xdoes nothing but copy a greyscale image from the input to the output. other processing options can then be added one by one; e.g.,mkbitmap -xf10does only highpass filtering,mkbitmap -xt0.5does only thresholding, etc. it's giving build-your-own-pipeline. π§-i,--invertβ invert the input image. if this option is chosen, it is applied to the image before any other operation. it is used to deal with white-on-black images, such as photographs of chalk drawings on a blackboard. note that the behavior of this option is not in general the same as inverting the output bitmap, unless the thresholding value is also inverted. β οΈ lowkey important, don't skip that note.-f n,--filter nβ apply a highpass filter to the image. this filter is approximately Gaussian and non-directional. the effect is to preserve small detail while compensating for background gradients. the parameter n is a radius (in pixels) which corresponds approximately to the size of details which should be preserved. more precisely, the filter is implemented by subtracting a blurred version of the image from the original image. the parameter n is equal to the standard deviation of the blur. the output of the filtering step is a normalized image whose average brightness is exactly0.5. the default filter radius is4. π-n,--nofilterβ turn off highpass filtering. bye filter π-b n,--blur nβ blur the image. the effect is to smooth out fine details and to reduce visual noise in the image. the parameter n is the blurring radius, and should be chosen small (1is a good value to start with). this is implemented as an approximately Gaussian, non-directional blur with standard deviation proportional to n. blurring is applied after the highpass filter, but before scaling and thresholding. if this option is not given, the default is not to apply any blurring. β¨-s n,--scale nβ scale the image by an integer factor n>0. scaling is done after highpass filtering, but before the thresholding step. a scaling factor of1indicates that no scaling is to be done. otherwise, interpolation is used to fill in the in-between pixels. if the output ofmkbitmapis to be used as input to a tracing program such aspotrace, a scaling factor of2is recommended. this preserved the right amount of detail for the tracing algorithm to work well. if a scaling factor of1is used, too much detail is lost. if a scaling factor of3or higher is used, the interpolation tends to "invent" detail which was not present in the original image, thus preventingpotracefrom doing a good job. π goldilocks energy fr fr-1,--linearβ use linear interpolation when scaling to a higher resolution. this is slightly faster, but less nice, than the default cubic interpolation.-3,--cubicβ use cubic interpolation when scaling to a higher resolution. this is the default. it is slower than linear interpolation, but leads to better results. main character energy π-t n,--threshold nβ set the threshold grey value for bilevel conversion. the parameter n is a brightness value between0for black and1for white. any pixels below this brightness will be converted to black (thus, smaller values of n will lead to whiter output). π€π€-g,--greyβ disable bilevel conversion. if this option is given, processing stops after the scaling step and a greymap is output. π«οΈ
π¦ EXIT STATUS π¦
the exit status is 0 on successful completion, 1 if the command line was invalid, and 2 on any other error. slay when it's 0, sad when it's not. π
β VERSION β
1.16
π AUTHOR π
Peter Selinger <selinger at users.sourceforge.net>
π WEB SITE AND SUPPORT π
mkbitmap is distributed as part of the potrace package, and the latest version is available from http://potrace.sourceforge.net/. this site also contains documentation and information on how to obtain support. go say hi bestie π«Ά
π SEE ALSO π
π COPYRIGHT π
Copyright (C) 2001-2019 Peter Selinger
this program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
this program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. see the GNU General Public License for more details.
you should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. see also http://www.gnu.org/. π
okay that's the whole page bestie, go forth and bitmapify πβ¨
Version 1.16 Β· September 2019 Β· General Commands Manual β mwah, love u, see u in the group chat ππ¦π
π¦ where this page comes from
- alpine 3.24: potrace-doc 1.16-r2 Β· GPL-2.0-or-later
- arch rolling: potrace 1.16-5 Β· GPL-2.0-or-later
- centos-stream 10: potrace 1.16-16.el10 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- centos-stream 9: potrace 1.16-7.el9 Β· GPLv2+
- centos-stream 9: potrace 1.16-7.el9 Β· GPLv2+
- debian bookworm: potrace 1.16-2 Β· GPL-2.0-or-later
- debian trixie: potrace 1.16-2+b2 Β· GPL-2.0-or-later
- fedora 43: potrace 1.16-15.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- fedora 43: potrace 1.16-15.fc43 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- fedora 44: potrace 1.16-16.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- fedora 44: potrace 1.16-16.fc44 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- nixos 26.05: potrace 1.16
- nixpkgs unstable: potrace 1.16
- opensuse-leap 16.0: potrace 1.16-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: potrace 1.16-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: potrace 1.16-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: potrace 1.16-160000.2.2 Β· GPL-2.0-or-later
- ubuntu jammy: potrace 1.16-2 Β· GPL-2.0-or-later
- ubuntu noble: potrace 1.16-2build1 Β· GPL-2.0-or-later
- ubuntu questing: potrace 1.16-2build1
- ubuntu resolute: potrace 1.16-2build2 Β· GPL-2.0-or-later
- ubuntu stonking: potrace 1.16-2build2 Β· GPL-2.0-or-later
- Copyright (C) 2001-2019 Peter Selinger
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms