Odd behavior: -annotate

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?".
Post Reply
briandavid78
Posts: 3
Joined: 2012-09-19T11:04:31-07:00
Authentication code: 67789

Odd behavior: -annotate

Post 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

Code: Select all

$identify -boardmember
Name: Brian
Development Environment: VB .NET, ASP .NET
Usage: Imports ImageMagickObject

$identify -version
Version: ImageMagick 6.7.9-6 2012-09-13 Q16
Features: OpenMP
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Odd behavior: -annotate

Post 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.
briandavid78
Posts: 3
Joined: 2012-09-19T11:04:31-07:00
Authentication code: 67789

Re: Odd behavior: -annotate

Post 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

Code: Select all

$identify -boardmember
Name: Brian
Development Environment: VB .NET, ASP .NET
Usage: Imports ImageMagickObject

$identify -version
Version: ImageMagick 6.7.9-6 2012-09-13 Q16
Features: OpenMP
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Odd behavior: -annotate

Post 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.
Post Reply