Re: tiff:photometric and CCITT compression

Bob Friesenhahn <[email protected]> Tue, 10 Oct 2023 12:13:16 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.help
Message-ID <[email protected]>
On Tue, 10 Oct 2023, frechefuchs via Graphicsmagick-help wrote:
>
> My interpretation of this is that when minisblack is requested, an
> encoder should:
>
> 1. invert the image,
> 2. compresses it with CCITT compression scheme,
> 3. set PhotometricInterpretation to 1 (BlackIsZero).
>
> A decoder processing and image with CCITT compression and BlackIsZero
> flag should
>
> 1. decompresses the image normally,
> 2. finally invert the image to compensate for the inversion by the
>   encoder.
>
> Does that make sense?

You make good points (in the spirit of TIFF!), but it is worthwhile to 
recognize that CCITT Group3 and Group4 compression represent ITU FAX 
standards, which have particular expectations/requirements.

A typical expectation of FAX is some black on a mostly-white page. 
According to https://en.wikipedia.org/wiki/Group_4_compression, 
compression will be poor if this is not the case.

There are also IETF specifications for Internet FAX.  RFC-2306 
(https://datatracker.ietf.org/doc/html/rfc2306), and RFC-3949
(https://datatracker.ietf.org/doc/html/rfc3949).  See 
https://datatracker.ietf.org/doc/search?csrfmiddlewaretoken=upwNIWODkLPOfLWBrd0dwOSTcR5pLuvz0I9Iu80pJAtyKfkAll67nfmO8W1o7qxR&name=TIFF&sort=&rfcs=on&activedrafts=on&by=group&group= 
for a list of IETF RFCs related to TIFF.

Another expectation is that it should be possible to take the bits 
from the TIFF file and feed them in prescribed order to a real FAX 
machine and that the bits are transferred as expected.  FAX machines 
do not understand "tags".

It would be good if GraphicsMagick can write IETF RFC-compliant TIFF 
files.  It likely does not do that now.  A prepared profile to enforce 
all of the correct parameters would be useful.

I am not against making it possible to encode a TIFF file as you 
describe (if libtiff itself will accept it), but am providing some 
reasons (perhaps very poor compression, and not compliant with the 
ITU-T T.6 FAX specification, and likely not read correctly by other 
applications) why this is not normally done.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt