GDI+ / GDIplus does not correctly handle icc profiles embedded in jpeg files IF the icc profile is greater the 65519 bytes.

Louis Solomon / SteelBytes
21/Jan/08

When using Image::GetPropertyItemSize()/Image::GetPropertyItem() (or GdipGetPropertyItemSize/GdipGetPropertyItem if using the 'flat api') for properyid PropertyTagICCProfile, nothing larger then 65519 bytes is returned. Admittedly profiles larger then 65519 are rare, but are legal and should be supported

A solution: 'walk' the jpeg file yourself retrieving all of the ICC_PROFILE chunks and then reassemble. note: the chunks can theortically be out of order, so watch the chunk ids.