Tinting occurs when reading/writing Bitmap - Why?

L

Lee Gillie

I am reading a TIF file which is 24bpp, and writing a JPG which is also
found to be 24bpp with code very close to that shown below. In the
process the deep red TIF colors are being transformed into a ruddy rust
in the jpg, and the blue highlights are being subdued. Color is not
being transformed radically, such as green for red, for example, it is
more subtle. It is almost as if a tint were being applied. How can I
elminate this color transformation?

Dim InBmp As Bitmap = New Bitmap(InputFileName)
Dim OutBmp As Bitmap
OutBmp = New Bitmap(InBmp, Width, Height)
OutBmp.Save(mOutputFileName(idx), ImageFormat.Jpeg)

Any hints would be greatly appreciated.
 
L

Lee Gillie

Lee said:
I am reading a TIF file which is 24bpp, and writing a JPG which is also
found to be 24bpp with code very close to that shown below. In the
process the deep red TIF colors are being transformed into a ruddy rust
in the jpg, and the blue highlights are being subdued. Color is not
being transformed radically, such as green for red, for example, it is
more subtle. It is almost as if a tint were being applied. How can I
elminate this color transformation?

Dim InBmp As Bitmap = New Bitmap(InputFileName)
Dim OutBmp As Bitmap
OutBmp = New Bitmap(InBmp, Width, Height)
OutBmp.Save(mOutputFileName(idx), ImageFormat.Jpeg)

Any hints would be greatly appreciated.

I think the problem occurs when reading the TIFF:

Dim InBmp As Bitmap = New Bitmap(InputFileName)
InBmp.Save("Test1.jpg", ImageFormat.Jpeg)

Dim InBmp As Bitmap = New Bitmap(InputFileName, True)
InBmp.Save("Test2.jpg", ImageFormat.Jpeg)

Dim InBmp As Bitmap = New Bitmap(InputFileName, False)
InBmp.Save("Test3.jpg", ImageFormat.Jpeg)

Dim InBmp As Bitmap = New Bitmap(InputFileName, True)
InBmp.Save("Test4.tif", ImageFormat.Tiff)

Dim InBmp As Bitmap = New Bitmap(InputFileName, False)
InBmp.Save("Test5.tif", ImageFormat.Tiff)

And even using the EncoderParameters for jpeg to set quality to 100 all
exhibit the same drop in color saturation.

Interestingly, upon reading the Tiff file, the BitMap object says the
pixel format is Format32bppArgb, even though Irfanview tells me this
Tiff format file is 24bpp. Is the difference between 32/24 a luminance
or brightness, or saturation plane? Could it be that BitMap is reading
the file and implying saturation data this is simply not there?

If so, I wonder what I can do about it?
 
Top