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

Notification

Icon
Error

Options
Go to last post Go to first unread
Jim Marriott  
#1 Posted : Tuesday, March 8, 2016 2:53:33 AM(UTC)
Jim Marriott

Rank: Newbie

Groups: Member
Joined: 3/8/2016(UTC)
Posts: 2

When using ToGdiPlusBitmap, is there a way to preserve the colour profile in the same way that GDI+ itself does when you load an image and pass the appropriate parameter:

public static Image FromStream(
Stream stream,
bool useEmbeddedColorManagement
)

If I use GraphicsMill to load the image (ImageReader.Create) then use ToGdiPlusBitmap(), the colours in the image look incorrect (or at least different!) when compared to the same image loaded using Image.FromStream with the useEmbeddedColorManagement parameyter set to true.

Is there any way round this?

Thanks!
Fedor  
#2 Posted : Wednesday, March 9, 2016 5:38:55 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
The colors are displayed incorrectly when an image has non-sRGB color space. So the easiest way to fix the problem is to convert an image to sRGB.

Code:
var gmBitmap = new Aurigma.GraphicsMill.Bitmap("../../../Copenhagen_RGB.jpg");

gmBitmap.ColorManagement.DestinationProfile = Aurigma.GraphicsMill.ColorProfile.FromSrgb();
gmBitmap.ColorManagement.Convert(gmBitmap.PixelFormat.HasAlpha ?
	Aurigma.GraphicsMill.PixelFormat.Format32bppArgb : Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);

var sdBitmap = gmBitmap.ToGdiPlusBitmap();

pictureBox1.Image = sdBitmap;

Edited by user Wednesday, March 9, 2016 5:41:29 AM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
Jim Marriott  
#3 Posted : Wednesday, March 9, 2016 7:02:42 AM(UTC)
Jim Marriott

Rank: Newbie

Groups: Member
Joined: 3/8/2016(UTC)
Posts: 2

Excellent - that works. Thanks Fedor.
Users browsing this topic
Guest
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.