Page 1 of 1

-annotate fails 1-bit tiffs

Posted: 2012-09-20T05:46:00-07:00
by briandavid78
This will create a 1-bit TIFF with a white background and black text:

Code: Select all

convert -size 3000x300 -depth 1 canvas:white -gravity east -fill black -pointsize 200 -annotate +0+0 "TEST STRING" withtext.tif
This will create the same image without the text:

Code: Select all

convert -size 3000x300 -depth 1 canvas:white justcanvas.tif
However, I can't annotate the justcanvas.tif file with this code:

Code: Select all

convert justcanvas.tif -gravity east -fill black -pointsize 200 -annotate +0+0 "TEST STRING" annotated.tif
If I omit "-depth 1" from the canvas creation script, the annotation script works.

-Brian

Re: -annotate fails 1-bit tiffs

Posted: 2012-09-20T09:37:11-07:00
by fmw42
I tried it and get the same results in IM 6.7.9.6. Note you get an alpha channel in annotated.tif which I disabled with -alpha off before writing the output. I even tried going to PNG8:- | convert - -depth 1 annotated.tif

I am not sure what the issue is. But why do you need to do this separately. Do you have a 1-bit tif already that you want to add text.

Re: -annotate fails 1-bit tiffs

Posted: 2012-09-20T09:49:19-07:00
by fmw42
Best I can suggest that works in unix is to use pipes to convert via GIF


convert -size 3000x300 canvas:white -depth 1 justcanvas.tiff
convert justcanvas.tiff GIF:- | \
convert - -gravity west -fill black -pointsize 200 -annotate +0+0 "TEST STRING" -alpha off -depth 1 GIF:- | \
convert - annotated.tif

Note I used -gravity west to make it easier to find the text on display

This also works and saves one pipe.

convert -size 3000x300 canvas:white -depth 1 justcanvas.tiff
convert justcanvas.tiff GIF:- | convert - -gravity west -fill black -pointsize 200 -annotate +0+0 "TEST STRING" -alpha off -type bilevel annotated.tiff

Re: -annotate fails 1-bit tiffs

Posted: 2012-09-20T16:26:23-07:00
by magick
Until we can come up with a patch, add +repage to your command line, e.g. convert justcanvas.tif +repage ... .