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

Notification

Icon
Error

Options
Go to last post Go to first unread
sontt  
#1 Posted : Friday, June 2, 2006 11:54:38 AM(UTC)
sontt

Rank: Member

Groups:
Joined: 6/2/2006(UTC)
Posts: 4

Hi,
I'm trying this feature to merge 2 image but it has an exception
Dimensions bitmap and mask bitmap are not the same

Please help me
Thanks

This is my code

Code:
private void Combine2Image()
		{
			Bitmap sourceBitmap = new Bitmap(Server.MapPath("copyrose.jpg"));
			Bitmap maskBitmap = new Bitmap(Server.MapPath("ipod.png"));
			Bitmap desBitmap = new Bitmap();
								
			PngEncoderOptions pngEncoderOptions = new PngEncoderOptions(0;
						
			Combiner combiner = new Combiner();
			combiner.SourceBitmap = sourceBitmap;
			
			combiner.ApplyMaskTransform(sourceBitmap,maskBitmap,desBitmap);
			desBitmap.Save(Server.MapPath("aaa.png"),pngEncoderOptions);
					
			
		}

Edited by user Wednesday, December 19, 2007 4:33:00 PM(UTC)  | Reason: Not specified

Dmitry  
#2 Posted : Friday, June 2, 2006 6:59:40 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 need to merge two bitmaps into one you should use the following code:
Code:
Bitmap bitmap1 = new Bitmap(Server.MapPath("copyrose.jpg"));
Bitmap bitmap2 = new Bitmap(Server.MapPath("ipod.png"));

Combiner combiner = new Combiner();
try
{
    combiner.SourceBitmap = bitmap1;
    combiner.ApplyTransform(bitmap2);
}
finally
{
    combiner.Dispose();
}
bitmap2.Save(Server.MapPath("dest.png));
This code sample draws bitmap1 onto bitmap2, and then saves it to PNG format.

Edited by user Wednesday, December 19, 2007 4:33:22 PM(UTC)  | Reason: Not specified

Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
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.