The metadata is taken from the PDF stream's dictionary, not from the image header inside the stream.
In a well-formed PDF file, the image metadata encoded in the stream dictionary should be the same as the one encoded in the image header.
This, however, is neither required nor checked and may not be true for an ill-formed PDF.
The metadata is taken from the PDF stream's dictionary, not from the image header inside the stream. In a well-formed PDF file, the image metadata encoded in the stream dictionary should be the same as the one encoded in the image header. This, however, is neither required nor checked and may not be true for an ill-formed PDF.