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

blending two bitmaps

I have a blank bitmap that I drew text on and then converted to CMYK ... now I'd like to blend or combine that image on top of a CMYK bitmap. Is there a way to do that?

Lisa
Hello Lisa,

Of course, you can do it. You should use Combiner transformation which allows you to combine two images. Here is small code sample, which draws text string onto bitmap, converts it to cmyk32 and then draws it onto another cmyk32 bitmap.
Aurigma.GraphicsMill.Bitmap bmp1 = new Aurigma.GraphicsMill.Bitmap(300, 100, Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);
Aurigma.GraphicsMill.Bitmap bmp2 = new Aurigma.GraphicsMill.Bitmap(@"d:/images/test/cmyk.jpg");

// Draw text string on bmp1.
Aurigma.GraphicsMill.Drawing.GdiGraphics graphics = bmp1.GetGdiGraphics();
Aurigma.GraphicsMill.Drawing.Font font = new Aurigma.GraphicsMill.Drawing.Font("Arial", 14);
try
{
	graphics.DrawString("Aurigma Graphics Mill for .NET", font, new Aurigma.GraphicsMill.Drawing.SolidBrush(Aurigma.GraphicsMill.RgbColor.Blue), 10, 10);
}
finally
{
	font.Dispose();
	graphics.Dispose();
}

// Convert bmp1 from rgb24 to cmyk32.
bmp1.ColorManagement.ConvertToContinuous(Aurigma.GraphicsMill.ColorSpace.Cmyk, true, false);

// Draw bmp1 onto bmp2.
Aurigma.GraphicsMill.Transforms.Combiner combiner = new Aurigma.GraphicsMill.Transforms.Combiner();
try
{
	combiner.SourceBitmap = bmp1;
	combiner.ApplyTransform(bmp2);
}
finally
{
	combiner.Dispose();
}

// Save bmp2 as result.
bmp2.Save(@"c:/1.tiff");
Thank you so much for the fast reply.
That works great.
Now, how do I adjust the opacity of the background on the text layer so that a gigantic black box doesn't blend on top of the cmyk picture?

Thank you!
Lisa
Hello Lisa,

You should use transparent background of temporary image with text. Here you can see code sample which merges two source CMYK images together and then adds text string. In your case you just should use one source bitmap instead of couple.