Bilevel tif annotate

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.
BlueD
Posts: 4
Joined: 2011-09-03T18:29:51-07:00
Authentication code: 8675308

Bilevel tif annotate

Post by BlueD »

Hi,

I tried to annotate a bilevel tiff file

Code: Select all

[D:\temp\02]identify 1.tif
1.tif TIFF 1392x2424 1392x2424+0+0 1-bit Bilevel DirectClass 29.2KB 0.000u 0:00.041

[D:\temp\02]convert 1.tif -fill black -stroke black -pointsize 100 -annotate +0+100 "Hello" 2.tif
No error message. But the result file (2.tif) is broken.

If I convert it to png

Code: Select all

[D:\temp\02]convert 1.tif -fill black -stroke black -pointsize 100 -annotate +0+100 "Hello" 2.png
Then everything is fine.

IM version: ImageMagick-6.7.2-0-Q8-windows-dll.exe

Code: Select all

[D:\temp\02]convert -version
Version: ImageMagick 6.7.2-0 2011-08-24 Q8 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
BlueD
Posts: 4
Joined: 2011-09-03T18:29:51-07:00
Authentication code: 8675308

Re: Bilevel tif annotate

Post by BlueD »

And if I add ccitt4 compression:

Code: Select all

[D:\temp\02]convert 1.tif -fill black -stroke black -pointsize 100 -annotate +0+100 "Hello" -compress group4 2.tif
Then everything is fine, again.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bilevel tif annotate

Post by fmw42 »

what exactly do you mean by broken?

This works fine for me on IM 6.7.2.1 Q16 (HDRI) Mac OSX Tiger

convert logo: -type bilevel logo_tmp1.tif
convert logo_tmp1.tif -fill black -stroke black -font Arial -pointsize 100 -annotate +0+100 "Hello" logo_tmp2.tif

what does the following tell you about the compression of your image?

identify -verbose 1.tif

perhaps it has to do with the type of compression in your input image.


you probably should post your tiff file for the IM developers to test and examine.
BlueD
Posts: 4
Joined: 2011-09-03T18:29:51-07:00
Authentication code: 8675308

Re: Bilevel tif annotate

Post by BlueD »

Code: Select all

convert logo: -type bilevel logo_tmp1.tif
convert logo_tmp1.tif -fill black -stroke black -font Arial -pointsize 100 -annotate +0+100 "Hello" logo_tmp2.tif
logo_tmp2.tif cannot be viewed in "Windows picture and fax viewer"(no preview available), showed rubbish in xnview and showed wrong colors in imdisplay.

That's what I mean "broken".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bilevel tif annotate

Post by fmw42 »

The this must be a windows issue. Hopefully the IM developers will be able to check it out.
Jason S
Posts: 103
Joined: 2010-12-14T19:42:12-07:00
Authentication code: 8675308

Re: Bilevel tif annotate

Post by Jason S »

The logo_tmp2.tif file I got was LZW-compressed, with a 1-bit black/white channel and a 1-bit alpha channel. This is an arguably-valid TIFF image, but application support for it is very low.

If you know you don't need transparency, doing something to remove it (e.g. "+matte") should help.
BlueD
Posts: 4
Joined: 2011-09-03T18:29:51-07:00
Authentication code: 8675308

Re: Bilevel tif annotate

Post by BlueD »

Thanks.

But why put the alpha channel there in the first place?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bilevel tif annotate

Post by fmw42 »

Again I would suggest you post a link to your image so that the IM developers or others can test with it.

Is the 1-bit alpha channel all opaque or part opaque and part transparent? What does identify -verbose yourimage.tif list?

I don't think IM supports a bilevelmatte type -- that is bilevel tiff with transparency. I have been unable to create a bilevel tiff with any kind of alpha channel (compressed or not)


convert logo: -type bilevel logo_bl.tif

convert logo_bl.tif -alpha copy logo_bl_alpha.tif
identify -verbose logo_bl_alpha.tif
Segmentation fault


convert logo_bl.tif -alpha opaque logo_bl_opaque.tif
identify -verbose logo_bl_opaque.tif
Segmentation fault
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bilevel tif annotate

Post by magick »

We get a bilevel TIFF image with an associated alpha channel as expected using ImageMagick 6.7.2-2 with LIBTIFF, Version 3.9.5.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bilevel tif annotate

Post by fmw42 »

magick wrote:We get a bilevel TIFF image with an associated alpha channel as expected using ImageMagick 6.7.2-2 with LIBTIFF, Version 3.9.5.

I was using IM 6.7.2.1 Q16 (HDRI) Mac OSX Tiger with libtiff 3.9.5 and was unsuccessful as above. What was your exact command to create the bilevel tiff with transparency (and LZW compression?).
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bilevel tif annotate

Post by magick »

We used the same command you did: convert logo_bl.tif -alpha copy logo_bl_alpha.tif.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bilevel tif annotate

Post by fmw42 »

magick wrote:We used the same command you did: convert logo_bl.tif -alpha copy logo_bl_alpha.tif.

I am still getting the same seg fault from the test above using IM 6.7.2.2 Q16 (HDRI) Mac OSX Tiger with libtiff 3.9.5.

convert logo: -type bilevel logo_bl.tif
convert logo_bl.tif -alpha copy logo_bl_alpha.tif
identify -verbose logo_bl_alpha.tif
segmentation fault

Might it have to do with HDRI mode?
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bilevel tif annotate

Post by magick »

HDRI should not be a factor. Try this
  • gdb identify
    run -verbose logo_bl_alpha.tif
    bt
Post the results.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bilevel tif annotate

Post by fmw42 »

magick wrote:HDRI should not be a factor. Try this
  • gdb identify
    run -verbose logo_bl_alpha.tif
    bt
Post the results.

Code: Select all

gdb identify
GNU gdb 6.3.50-20050815 (Apple version gdb-696) (Sat Oct 20 18:20:28 GMT 2007)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "powerpc-apple-darwin"...
warning: --arch option not supported in this gdb.
Reading symbols for shared libraries ............................. done

(gdb) run -verbose logo_bl_alpha.tif
Starting program: /usr/local/bin/identify -verbose logo_bl_alpha.tif
Reading symbols for shared libraries .+.+++.................................................................++++++++++++++++++++ done
Reading symbols for shared libraries . done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x02eb5000
0x0112239c in ImportQuantumPixels (image=0x2004600, image_view=0x0, quantum_info=0x2908dd0, quantum_type=GrayAlphaQuantum, pixels=0x200d800 '?' <repeats 160 times>, exception=0x29039b0) at magick/quantum-import.c:1648
1648                SetPixelBlue(q,GetPixelRed(q));
(gdb) bt
#0  0x0112239c in ImportQuantumPixels (image=0x2004600, image_view=0x0, quantum_info=0x2908dd0, quantum_type=GrayAlphaQuantum, pixels=0x200d800 '?' <repeats 160 times>, exception=0x29039b0) at magick/quantum-import.c:1648
#1  0x01e42ff4 in ReadTIFFImage (image_info=0x1e3b000, exception=0x29039b0) at coders/tiff.c:1248
#2  0x01046c90 in ReadImage (image_info=0x1e36000, exception=0x29039b0) at magick/constitute.c:523
#3  0x01047adc in ReadImages (image_info=0x1e36000, exception=0x29039b0) at magick/constitute.c:889
#4  0x00652070 in IdentifyImageCommand (image_info=0x0, argc=3, argv=0x2904030, metadata=0xbffffac8, exception=0x29039b0) at wand/identify.c:319
#5  0x006838a0 in MagickCommandGenesis (image_info=0xfb000, command=0x651850 <IdentifyImageCommand>, argc=3, argv=0xbffffbcc, metadata=0xbffffac8, exception=0x29039b0) at wand/mogrify.c:169
#6  0x00002c90 in IdentifyMain (argc=3, argv=0xbffffbcc) at utilities/identify.c:80
#7  0x0000284c in _start ()
#8  0x00002550 in start ()
(gdb)  
It seems to stop here and repeat each time I hit "return". So I cancelled here. Let me know if I should let it run longer or do something at each (gdb) prompt.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Bilevel tif annotate

Post by magick »

We can reproduce the problem. Look for a patch in ImageMagick 6.7.2-3 Beta available by sometime tomorrow. Thanks.
Post Reply