Page 1 of 1

Odd behavior: -annotate

Posted: 2012-09-19T12:49:24-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 -stroke none -fill black -pointsize 200 -annotate 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 -stroke none -fill black -pointsize 200 -annotate 0 "TEST STRING" annotated.tif
My understanding of the commands is that the "-size 3000x300 -depth 1 canvas:white" portion of the first command simply creates the canvas on which the annotation resides. Replacing that portion of the code with an existing image, however, does not result in an annotated image?

I'm assuming it has to do with the bit depth, because if I omit the "-depth 1" from those same commands, it works fine. I'm sure I'm missing something obvious, but I just can't see what it is! These annotations are going to be merged with gigantic 1-bit TIFF images eventually so I need this to work in 1-bit.

Thanks for any help you can give!

-Brian

Re: Odd behavior: -annotate

Posted: 2012-09-19T16:27:25-07:00
by fmw42
why -stroke none? If you use -stroke somecolor, I believe you may need to supply -strokewidth. Why not leave off the -stroke and -strokewidth

try

convert justcanvas.tif -gravity east -fill black -pointsize 200 -annotate +0+0 "TEST STRING" annotated.tif


It is also a good idea when asking a question, to supply your IM version and platform.

Re: Odd behavior: -annotate

Posted: 2012-09-20T05:38:54-07:00
by briandavid78
Thanks for the response, Fred.

The results of your script are the same as mine; an empty canvas. I'm going to have to create an 8-bit tiff then convert to 1-bit, I guess.

I added my details in the signature; thanks for the reminder!

-Brian

Re: Odd behavior: -annotate

Posted: 2012-09-20T09:36:56-07:00
by fmw42
I tried it and get the same results. 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.