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 JPEG images using Adobe RGB. I would like to use sRGB for all thumbnails and medium size images
I am using dotnet (asp.net) and need a way to convert from Adobe RGB to sRGB without losing any quality.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With