This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Notification

Icon
Error

Options
Go to last post Go to first unread
AlexAseev  
#1 Posted : Thursday, May 11, 2017 4:43:37 AM(UTC)
AlexAseev

Rank: Newbie

Groups: Guest
Joined: 5/8/2017(UTC)
Posts: 5

Hi, I need to enlarge image canvas keeping the picture exactly same, the code works great for RGB, but noticed that CMYK with embedded color profile became darker with every enlarge.

It looks to me that graphics.DrawImage procedure is doing someth like CMYK->RGB->CMYK . It is very important to keep the colors . Following code is just an example to show how it can change the colors, bcz sometimes it is difficult to see with the eyeBrick wall , but 6 itterations is enough. Please advise is there any better way for this taks?

Code:

        private void button3_Click(object sender, EventArgs e)
        {
            enlargeCanvas(@"before_enlarge.tif", @"after_enlarge.tif");
            enlargeCanvas(@"after_enlarge.tif", @"after_enlarge2.tif");
            enlargeCanvas(@"after_enlarge2.tif", @"after_enlarge3.tif");
            enlargeCanvas(@"after_enlarge3.tif", @"after_enlarge4.tif");
            enlargeCanvas(@"after_enlarge4.tif", @"after_enlarge5.tif");
            enlargeCanvas(@"after_enlarge5.tif", @"after_enlarge6.tif");
        }

        private void enlargeCanvas(string in_file, string out_file)
        {
            //ADD 10px White Coloredd  stripe to the left of original image  & preserve PixelFormat and Color Profile
            var left = 10;


            using (var image = new Aurigma.GraphicsMill.Bitmap(in_file))
            {
                var destRect = new Rectangle(left, 0, image.Width, image.Height);

                var destBitmap = new Aurigma.GraphicsMill.Bitmap(image.Width + left, image.Height, image.PixelFormat,
                    Color.White);
                destBitmap.Palette = image.Palette;
                destBitmap.ColorProfile = image.ColorProfile;

                destBitmap.DpiX = image.DpiX;
                destBitmap.DpiY = image.DpiY;

                using (var graphics = destBitmap.GetAdvancedGraphics())
                {
                    graphics.DrawImage(image, destRect);
                }
                destBitmap.Save(out_file);
            }
        }


before_enlarge.tif (3,202kb) downloaded 7 time(s).changes.JPG after_enlarge6.tif (3,496kb) downloaded 6 time(s).

Fedor  
#2 Posted : Thursday, May 11, 2017 6:26:20 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Guest
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Hi Alex,

We confirm the problem (Aurigma Bug #0023306) and will fix it in June. I will keep you informed of the status.

Meanwhile, you can the Bitmap.Draw method as a workaround:

Code:
private static void enlargeCanvas(string in_file, string out_file)
{
	//ADD 10px White Coloredd  stripe to the left of original image  & preserve PixelFormat and Color Profile
	var left = 10;

	using (var image = new Aurigma.GraphicsMill.Bitmap(in_file))
	{
		var destRect = new Rectangle(left, 0, image.Width, image.Height);

		var destBitmap = new Aurigma.GraphicsMill.Bitmap(image.Width + left, image.Height, image.PixelFormat,
			Color.White);
		destBitmap.Palette = image.Palette;
		destBitmap.ColorProfile = image.ColorProfile;

		destBitmap.DpiX = image.DpiX;
		destBitmap.DpiY = image.DpiY;

		/*
		using (var graphics = destBitmap.GetAdvancedGraphics())
		{
			graphics.DrawImage(image, destRect);
		}
		*/

		destBitmap.Draw(image, destRect, Aurigma.GraphicsMill.Transforms.CombineMode.Copy,
			Aurigma.GraphicsMill.Transforms.ResizeInterpolationMode.Low);


		destBitmap.Save(out_file);
	}
}
Best regards,

Fedor Skvortsov

Fedor  
#3 Posted : Friday, June 9, 2017 3:49:57 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Guest
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
We fixed the problem in the recently released version 9.1.14.
Best regards,

Fedor Skvortsov

Users browsing this topic
Guest (2)
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.