Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1448

[VB6] Color Management - Different Approach

$
0
0
The class included in the attached zip file is intended for those that want to add some color management to their VB projects with minimal effort. The color management class (cICMLite) uses GDI higher level color management built-in functions and returns the image as a stdPicture object suitable to assigning to picture box, image control, etc, or selecting the picture handle into a DC for BitBlt and other rendering functions.

Pros:
1. Easy to use. Call the cICMLite.LoadPIctureICM function to return the image as a stdPicture
2. Unicode supported. Can optionally use the class as a unicode-friendly version of VB's LoadPicture
3. Can load PNG and TIFF files that GDI+ can read/process
4. CMYK jpgs handled without any additional requirements when run on Win7 or better
5. Can load alpha bitmaps, both premultiplied and not
6. Can load bitmaps using versions 4 & 5 of the BitmapInfoHeader format

Cons:
1. CMYK jpgs are not supported on XP but requires GDI+ v1.1 manifest when run on Vista
2. Transparency in PNG, TIFF, & bitmap images is filled with a backcolor your provide to cICMLite. This is because VB stdPictures do not support transparency except for icons & gifs.
3. Minor limitation. Cannot use the class for soft proofing printer ICM profiles.
4. Since icons don't support ICM, they are not specifically handled and passed to VB's LoadPicture. We all know that VB is quite limited with support for modern icons. However, you do not have to use the class to load any image files. You could also add your own custom handling routine to the class to handle modern icons.
5. When running on Vista or XP, GDI+ versions have some bugs that can prevent color managment profiles from being read

Some notes
1. In the class, you may find the pvValidateAlphaChannel logic useful for other graphic routines
2. GIFs, containing ICM profiles, are processed based on theory. I have not found any in the wild. The logic is unique
3. BMPs, containing ICM profiles, are processed based on theory. I've found only one in the wild & it was a test image
Since GDI+ does not honor alpha channels in bitmaps, and VB cannot load versions 4/5 of the BitmapInfoHeader, all bitmaps are processed manually. When possible, passed off to VB. The logic in the handling routines perform minimal sanity checks. Feel free to beef it up if desired.
4. GDI+ is used to extract ICM profiles from JPG, PNG, TIFF. Not guaranteed to find these if they exist in meta data tags vs. known ICM tags.

Since forum rules limit amount of stuff we attach, I'll include a link to my hotmail's one-drive where you can download additional images to play with. Googling for ICM Profiles can also yield more images to play with.
Attached Files

Viewing all articles
Browse latest Browse all 1448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>