When converting black and white images from TIFF to PDF (image embedded in page) or back, the image's colors may get inverted: Tif to PDF conversion Inverse problem https://blog.idrsolutions.com/2011/08/ccitt-encoding-in-pdf-files-black-and-white-facts/
So, given a binary TIFF file, I'd like to invert its colors, but without re-encoding or re-compressing the data. It is possible to do so by editing the metadata only and I'd like to know how.
Any open source tool, library or programming language is okay for me. From what I've gathered so far, there are multiple steps in the decoding pipeline that may achieve the desired result (add some flag, flip the color palette, etc.).