Page 1 of 1

Binary image (1 bit per pixel) c++ API

Posted: 2017-01-14T22:00:10-07:00
by bronstein87
Is there an opportunity to construct binary (1bit) images and convert other images to this format using c++ api? I coudnt find any information about this.

Re: Binary image (1 bit per pixel) c++ API

Posted: 2017-01-14T22:36:20-07:00
by fmw42
I do not program in C++, but see depth and monochrome at https://www.imagemagick.org/Magick++/Image++.html

Re: Binary image (1 bit per pixel) c++ API

Posted: 2017-01-14T23:18:21-07:00
by bronstein87
fmw42 wrote: 2017-01-14T22:36:20-07:00 I do not program in C++, but see depth and monochrome at https://www.imagemagick.org/Magick++/Image++.html
I have already seen that and If I correctly understand, depth can be only from 8 to 32 bit, and what about monochrome(), it looks like grayscale transform, so I need exact answer

Re: Binary image (1 bit per pixel) c++ API

Posted: 2017-01-15T00:14:17-07:00
by fmw42
depth can be 1 if the output file format supports it

monochrome converts to black/white (1-bit)

See http://www.imagemagick.org/script/comma ... monochrome

You can also use the equivalent of -type bilevel

Or you can use the equivalent of -threshold to convert to 1-bit result.

All these depend upon whether the image format supports 1-bit; otherwise, though it is only black and white, the type will show as either grayscale or palette.

Re: Binary image (1 bit per pixel) c++ API

Posted: 2017-01-15T02:11:35-07:00
by snibgo
bronstein87 wrote:Is there an opportunity to construct binary (1bit) images and convert other images to this format using c++ api? ... so I need exact answer
But the question is vague.

Images can be saved in files that are one bit per pixel, and read from those files.

Images can be processed as black and white only, or as grayscale, or as colour.

When processing an image, it is stored in memory as either palette or non-palette. For non-palette processing, the minimum storage is 8 bits/channel/pixel. The processing might use only two of the possible 256 values.

Re: Binary image (1 bit per pixel) c++ API

Posted: 2017-01-15T06:56:59-07:00
by bronstein87
fmw42 wrote: 2017-01-15T00:14:17-07:00 depth can be 1 if the output file format supports it

monochrome converts to black/white (1-bit)

See http://www.imagemagick.org/script/comma ... monochrome

You can also use the equivalent of -type bilevel

Or you can use the equivalent of -threshold to convert to 1-bit result.

All these depend upon whether the image format supports 1-bit; otherwise, though it is only black and white, the type will show as either grayscale or palette.
Ok, I will try, thank you. But, I probably incorrectly expressed, I talking about pixel format, not image. Look at this link: http://doc.qt.io/qt-4.8/qimage.html#Format-enum. So, I am talking about creating image with some pixel format, not image.

Re: Binary image (1 bit per pixel) c++ API

Posted: 2017-01-15T14:16:10-07:00
by fmw42
I do not know to what in that reference you are considering. IM has many image out data types that range from 32-bits per pixel total color for all channels, to 1-bit per pixel total color for all channels. Most images are 8-bits per channel per pixel, but you can have 1-bit for only 1 channel per pixel (binary black/white data)