Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Adding installed Image Color Profiles (.icm) into an image in C#

$
0
0
In one of my C# project (.net framework 4.0), I need to add the installed color profiles in windows, into images if it already have no color profiles in it. I Google and found nothing in .net for the color profile management, So I adopt the imagemagick library and use its "addprofile" method but after adding and saving the image whenever i ready the image it doesn't contain the color profile. While searching on the internet I found to apply colorprofile.sRGB before applying your custom color profile and I do the same and when I read the image it contain the color profile "icc" in the image. Following is color profile adding code
using (MagickImage image = new MagickImage(outputFilePath))
        {
            ImageMagick.ColorProfile colorProfile = image.GetColorProfile();
            if (colorProfile == null)
            {
                //Add sRGB color profile before adding your custom color profile
                image.AddProfile(ImageMagick.ColorProfile.SRGB);
                //ICSPrfile is the object containing the name and path of availabe prfiles
                //_profilesRGB is the list containing the ICSProfiles
                foreach (ICSProfile prof in _profilesRGB)
                    if (prof.Name.Equals(comboBoxRGBProfile.SelectedItem))
                        image.AddProfile(new ImageMagick.ImageProfile(prof.Name, File.ReadAllBytes(prof.FilePath)));

                //Write update profile file
                image.Write(outputFilePath);
            }//End if
        }//End using
Now, I am not sure, after writing this code whether my image contain the custom color profile or not.Did I wrote a correct code? and how can I check the color profiles in an image.

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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