In the generated SVG file, in the “Image” Element, and in the attributes “xlink:href”, sometimes the value contains “_msk”. Then the associated image is a sort of negative; its colours are the inverse of the image in the source PDF.
For example, the SVG contains this output:
Why are the colours inverted? Is the non-inverted image available? How can we test whether or not the image is inverted?
These are image masks, which will appear inverted if you view them as images. From the PDF specification:
An image mask (an image XObject whose ImageMask entry is true) is a monochrome image, in which each sample is specified by a single bit. However, instead of being painted in opaque black and white, the image mask is treated as a stencil mask that is partly opaque and partly transparent. Sample values in the image do not represent black and white pixels; rather, they designate places on the page that should either be marked with the current color or masked out (not marked at all). Areas that are masked out retain their former contents. The effect is like applying paint in the current color through a cut-out stencil, which allows the paint to reach the page in some places and masks it out in others.
Only the image mask exists – no “non-inverted” version of the image exists.
The tag is within a tag. Use that to test whether the image is inverted.