Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
persa  
#1 Posted : Thursday, December 01, 2005 11:46:51 PM(UTC)
persa

Rank: Member

Groups: Member
Joined: 12/1/2005(UTC)
Posts: 3

I have images with embedded color profiles, an example is a Jpg image with Adobe RGB 1998 profile I want to convert these to use another color profile and make sure the new target profile is embedded with each saved image. The image data should also be transformed to preserve the image to as close as possible to the original one.

How should this procedure be performed with Graphics Mill.NET?

I have found that this code converts the image data and then embeds the profile with the result file but I don't like that I have to reload the file and save it all over again. On my machine the image is saved without profile in the middle step... Why won't the profile save with the image in this first save operation?

Code:
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap();

// Load image and convert it to sRGB color profile
bitmap.Load(@"c:\original_with_embedded_profile_adobe.jpg");
bitmap.ColorManagement.ColorManagementEnabled = true;
bitmap.ColorManagement.RgbColorProfile = Aurigma.GraphicsMill.ColorProfile.FromSrgb(); bitmap.ColorManagement.TransformationIntent = ColorTransformationIntent.Perceptual;
bitmap.ColorManagement.ConvertToContinuous(ColorSpace.Rgb, true, false);
bitmap.ColorProfile = Aurigma.GraphicsMill.ColorProfile.FromSrgb();		
bitmap.Save(@"c:\result_saved_without_profile.jpg", new Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(100, false));
bitmap.Dispose();

// Now I have to reload the image and save it again to get the profile embedded with it.		
bitmap = new Aurigma.GraphicsMill.Bitmap();
bitmap.ColorManagement.ColorManagementEnabled = true;
bitmap.Load(@"c:\result_saved_without_profile.jpg");
bitmap.ColorProfile = Aurigma.GraphicsMill.ColorProfile.FromSrgb();
bitmap.Save(@"c:\result_saved_with_profile.jpg", new Aurigma.GraphicsMill.Codecs.JpegEncoderOptions(100, false));
bitmap.Dispose();



/Per Salmi

Edited by user Sunday, December 23, 2007 4:46:51 PM(UTC)  | Reason: Not specified

Dmitry  
#2 Posted : Friday, December 02, 2005 2:47:44 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello,

If you have an image with embeded color profile and you want to convert this image into the same color space with another color profile, you are able to perform this using the following code snippet:
Code:
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(@"d:/images/test/embededprofile.png");
bitmap.ColorManagement.ColorManagementEnabled = true;
bitmap.ColorManagement.RgbColorProfile = Aurigma.GraphicsMill.ColorProfile.FromSrgb();
bitmap.ColorManagement.ConvertToContinuous(Aurigma.GraphicsMill.ColorSpace.Rgb, false, false);
bitmap.Save(@"c:/newembededprofile.jpg");
bitmap.Dispose();

After that file "newembededprofile.jpg" will contain new embeded Srgb profile.

Edited by user Sunday, December 23, 2007 4:47:02 PM(UTC)  | Reason: Not specified

Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
persa  
#3 Posted : Tuesday, December 06, 2005 7:17:47 PM(UTC)
persa

Rank: Member

Groups: Member
Joined: 12/1/2005(UTC)
Posts: 3

Thanks,
It works perfectly!

/Per Salmi

Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.