Large 1bit BMP with text, how ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
myicq
Posts: 29
Joined: 2012-04-11T04:23:21-07:00
Authentication code: 8675308

Large 1bit BMP with text, how ?

Post by myicq »

I have a need to create a (large) 1bit BMP file with text inside.

The file must be identical in type to this one, created using PaintShop Pro:
https://dl.dropboxusercontent.com/u/224 ... e_test.zip

The image identifies as

Code: Select all

large_image.bmp BMP 3000x1200 3000x1200+0+0 1-bit sRGB 2c
I can create similar blank (white) image, but I have had no luck producing similar image with large text.

At the moment I have two issues:
  • pointsize in annotate seems to be ignored, I need to have a text with pointsize from 150 to 350
  • no matter what I have tried, the output is always 24 bit BMP, resulting in massive files
Can anyone produce a simple example what gives a 1-bit BMP, white background, black (large) text.

The final size of BMP should be 65000 x 1200 pixel, resulting in around 9753662 bytes.

Thankful for any assistance.

Code: Select all

Version: ImageMagick 6.8.6-8 2013-08-04 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib djvu fftw fontconfig freetype jng jp2 jpeg lcms lzma openexr pango png ps tiff webp x xml zlib

snibgo
Posts: 13034
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Large 1bit BMP with text, how ?

Post by snibgo »

It seems that IM doesn't generally want to create bilevel BMP files. But it will do, if the input is a bilevel PNG.

Annotate works, as far as I know. "-gravity" is generally needed.

Code: Select all

convert -size 65000x1200 xc:White -pointsize 300 +antialias -fill Black -gravity Center -annotate 0x0 "Large File" -type bilevel x.png

convert x.png x.bmp

identify x.bmp
(Windows script. For Unix or Max, use single quotes instead of double quotes.)
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Large 1bit BMP with text, how ?

Post by fmw42 »

try writing out to BMP3:image.bmp or BMP2:image.bmp I am not sure BMP4 (the default) supports 1-bit. See http://www.imagemagick.org/Usage/formats/#bmp

myicq
Posts: 29
Joined: 2012-04-11T04:23:21-07:00
Authentication code: 8675308

Re: Large 1bit BMP with text, how ?

Post by myicq »

snibgo wrote:It seems that IM doesn't generally want to create bilevel BMP files. But it will do, if the input is a bilevel PNG.
Thank you :) It's beyond my understanding why this is not working, since it's such a simple format and used everywhere in Windows + industrial machines world. Oh well.

I can achieve the goal, and that's the point. Now I just have to play around with annotate and draw.

Thanks for your help again.

Locked