|
List Info
Thread: Bitonal bitmap out
|
|
| Bitonal bitmap out |

|
2007-01-23 08:35:07 |
|
OK, one more stupid question:
I want to output a bitonal bitmap. Nothing else, no header,
one bit per pixel, so that a 80x256 pixel bitonal image produces
a 2560-byte output.
'mono' format does exactly that, but the byte-ordering is
lsb-first, whilst I want the reverse.
...and for bonus points I want to do it with perlmagick.
I'm sure this is just my ignorance of available formats, or
I'm missing imagetoblob parameters, but honestly I've tried
my best and I can't get it.
--
Illtud Daniel illtud.daniel llgc.org.uk
Uwch Ddadansoddwr Systemau Senior Systems Analyst
Llyfrgell Genedlaethol Cymru National Library of Wales
Yn siarad drosof fy hun, nid LlGC - Speaking personally, not for NLW
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-users
|
| Re: Bitonal bitmap out |

|
2007-01-23 09:33:52 |
|
> 'mono' format does exactly that, but the byte-ordering is
> lsb-first, whilst I want the reverse.
The option "-enian" should be the solution:
-endian type
specify endianness (MSB or LSB) of the image.
Use the -list option with a 'Endian' argument for a list of -endian
arguments available in your IM installation.
Wolfgang Hugemann
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-users
|
| Re: Bitonal bitmap out |

|
2007-01-23 10:04:15 |
|
Wolfgang Hugemann wrote:
> The option "-enian" should be the solution:
Yes, you'd think so, wouldn't you. But:
[ild leri statws]$ convert -list Endian
LSB
MSB
[ild leri statws]$ convert test.pbm test.mono
[ild leri statws]$ convert -endian LSB test.pbm test-lsb.mono
[ild leri statws]$ convert -endian MSB test.pbm test-msb.mono
[ild leri statws]$ diff test.mono test-lsb.mono
[ild leri statws]$ diff test.mono test-msb.mono
[ild leri statws]$
Basically they make no difference (and yes, test.pbm is a
bitonal bitmap). Unless I'm doing it wrong.
The mono format is specifically lsb, so it's probably doing the
right thing by ignoring my endian param, but I can't get what
I need - a simple bitonal bitmap without header in msb.
--
Illtud Daniel illtud.daniel llgc.org.uk
Uwch Ddadansoddwr Systemau Senior Systems Analyst
Llyfrgell Genedlaethol Cymru National Library of Wales
Yn siarad drosof fy hun, nid LlGC - Speaking personally, not for NLW
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-users
|
| Re: Bitonal bitmap out |

|
2007-01-23 10:43:35 |
|
> Basically they make no difference (and yes, test.pbm is a
> bitonal bitmap). Unless I'm doing it wrong.
I rather think, you should put it this way round, in order to load the
image first:
convert test.pbm -endian LSB test-lsb.mono
> The mono format is specifically lsb, so it's probably doing the
> right thing by ignoring my endian param, but I can't get what
> I need - a simple bitonal bitmap without header in msb.
But anyway this seems to make no difference, as the mono format probably
settles whether to use msb or lsb. I yielded the same result un my
Windows machine. In fact I got different results when using the
versatile TIF format as the destination format. In this case, "msb.tif"
and "lsb.tif" really differed.
You will probably have to use an external tool to switch the byte order.
Wolfgang Hugemann
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-users
|
| Re: Bitonal bitmap out |

|
2007-01-23 18:16:39 |
|
Illtud Daniel on wrote...
| OK, one more stupid question:
|
| I want to output a bitonal bitmap. Nothing else, no header,
| one bit per pixel, so that a 80x256 pixel bitonal image produces
| a 2560-byte output.
|
| 'mono' format does exactly that, but the byte-ordering is
| lsb-first, whilst I want the reverse.
|
| ...and for bonus points I want to do it with perlmagick.
|
| I'm sure this is just my ignorance of available formats, or
| I'm missing imagetoblob parameters, but honestly I've tried
| my best and I can't get it.
|
You could try the PBM format, and delete the header.
A PBM file usally consists of one line (the P1 is files 'magic number')
P1 width height
Then binary raster, immedaitely following single white space character
after the height ascii number (usally a newline character).
* row by row from top to bottom
* Each row is width packed 8 to a byte, with don’t care bits to fill out
the last byte in the row
* in order left to right most significant bit to least significate bit
* 1 = black 0 = white
It sound like just what you want, so just strip the first line and
you have your raw bitonal bitmap. If you want 0=black, -negate te image
before the save.
Anthony Thyssen ( System Programmer ) griffith.edu.au>
-----------------------------------------------------------------------------
Don't you just hate those long signature files? I mean, there oughta
be a law. If I were in control, .sigs would get cut off if they were
-----------------------------------------------------------------------------
Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
Magick-users imagemagick.org
http://studio.imagemagick.org/mailman/listinfo/magick-users
|
[1-5]
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|