Converting JPEG colorspace (Adobe RGB to sRGB) on Windows (.Net)

后端 未结 5 1605
天命终不由人
天命终不由人 2021-01-05 13:58

I need to generate thumbnail and medium sized images from large photos. These smaller photos are for display in an online gallery. Many of the photographers are submitting

5条回答
  •  孤街浪徒
    2021-01-05 14:25

    Background info: Jpg files have 8 bits of red, green, and blue, whether sRGB,Adobe RGB, or plain ol' RGB. The ICC descriptor determines the color space. Sometimes this is embedded in the jpg file. Sometimes there is a flag to designate sRGB, Exif Colorspace tag a001 = 1. There is no standard flag for Adobe RGB, but some applications and cameras use 65535 (uncalibrated) for Adobe RGB in the exif tag A001.

    To convert a jpg file from from one ICC profile (colorspace) to another, you can use CreateColorTransform to create a transorm between the color spaces. You will need to provide the ICC profile for the source (Adobe RGB) and destination (sRGB) color spaces.

    After you have the transform, use TranslateBitmapBits to adjust the pixels. It may be easier to work with the image as a DIBSection.

    This may be a bit complex to write in .asp, so it might be easier to use a graphics library that does this.

提交回复
热议问题