Ack! IM Tiffs turn bright green when dropped into Word

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?".
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Ack! IM Tiffs turn bright green when dropped into Word

Post by snibgo »

I use Windows but not MS Word. Sorry.

I do use OpenOffice. When I Insert >Picture > Fromfile FQ68DTFT_Fig2.tif (from the OP), the result is mostly black, with gray edges to the letters. This would be from the unassociated alpha. If I "convert FQ68DTFT_Fig2.tif -alpha off x.tif" and insert a.tif into the document, I get black letters on the white background, as expected.

Other options that may (or may not) help:
-alpha associate
-define tiff:alpha=associated
snibgo's IM pages: im.snibgo.com
MADubs
Posts: 36
Joined: 2014-06-18T11:38:08-07:00
Authentication code: 6789

Re: Ack! IM Tiffs turn bright green when dropped into Word

Post by MADubs »

Ah, interesting! I did try -alpha associate and got an error:

mogrify: UnrecognizedAlphaChannelType `associate' @ error/mogrify.c/MogrifyImageCommand/3961.

Any idea what that is? Also, does it matter where in the command you put these snippets of code? Does it change depending on the order?
MADubs
Posts: 36
Joined: 2014-06-18T11:38:08-07:00
Authentication code: 6789

Re: Ack! IM Tiffs turn bright green when dropped into Word

Post by MADubs »

snibgo, could you upload that tiff somewhere (the one that worked), so I can test it in Word?
MADubs
Posts: 36
Joined: 2014-06-18T11:38:08-07:00
Authentication code: 6789

Re: Ack! IM Tiffs turn bright green when dropped into Word

Post by MADubs »

Code: Select all

mogrify -format tif -depth 8 -density 1200 -compress lzw -define tiff:alpha=associated -flatten *.ai
Doesn't change anything for me, unfortunately.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Ack! IM Tiffs turn bright green when dropped into Word

Post by snibgo »

"-alpha [dis]associate" seem to be very new operations in IM.

I tried this (Windows BAT syntax):

Code: Select all

set SRC=FQ68DTFT_Fig2.tif

exiftool -s2 -all -b -X -fXMP:XMP %SRC% |findstr /I alpha


%IM%convert %SRC% -alpha off fq_a_off.tiff

exiftool -s2 -all -b -X -fXMP:XMP fq_a_off.tiff |findstr /I alpha


%IM%convert %SRC% -define tiff:alpha=associated fq_assoc.tiff

exiftool -s2 -all -b -X -fXMP:XMP fq_assoc.tiff |findstr /I alpha


%IM%convert %SRC% -define tiff:alpha=unassociated fq_unassoc.tiff

exiftool -s2 -all -b -X -fXMP:XMP fq_unassoc.tiff |findstr /I alpha
The only one that works, in OpenOffice, was fq_a_off.tiff.

I have uploaded all three fq_*.tiff files to snibgo.com/imforums. You can wget them, eg:

Code: Select all

wget snibgo.com/imforums/fq_assoc.tiff
They are big, so I'll only leave them up for a week or so.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Ack! IM Tiffs turn bright green when dropped into Word

Post by fmw42 »

Test with convert rather than mogrify. Mogrify is old and does not have all the options that convert does. -alpha associate is, I believe, to support IM 7 and probably does not mean anything for IM 6. The -define for tiff:alpha is relatively new, though I cannot find any mention of it being added in the changelog. I hope you are on a reasonably current version of IM
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Ack! IM Tiffs turn bright green when dropped into Word

Post by fmw42 »

try also -define tiff:alpha=unspecified. That was recently added in the last few releases. I think it was 6.8.9.9
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Ack! IM Tiffs turn bright green when dropped into Word

Post by whugemann »

This problem has been annoying me for years now. (I think, I also mentioned it on this board.)
Today I found out that the instertion of a simple "-colorspace gray" does the trick, i.e. something along the lines of (Windows batch file):

Code: Select all

convert -density 300 %1 -trim  -colorspace gray -compress group4 -scene 1 "%~dpn1-%%02d.tif"
The proposed alpha channel settings could not cure the effect.
With the above code, the TIFFs now have white instead of green background when inserted into a Word document.
Wolfgang Hugemann
Post Reply