-annotate fails 1-bit tiffs

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
briandavid78
Posts: 3
Joined: 2012-09-19T11:04:31-07:00
Authentication code: 67789

-annotate fails 1-bit tiffs

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 -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

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: -annotate fails 1-bit tiffs

Post 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.
Last edited by fmw42 on 2012-09-20T09:56:18-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -annotate fails 1-bit tiffs

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -annotate fails 1-bit tiffs

Post by magick »

Until we can come up with a patch, add +repage to your command line, e.g. convert justcanvas.tif +repage ... .
Post Reply