1

If I combine two images using the technique described here:

Combine two Images into one new Image

How can I reconstruct the two separate images from their combined form?

Community
  • 1
  • 1
dr_rk
  • 4,395
  • 13
  • 48
  • 74
  • I'd think you'd need to know the pixel coordinates of each image, and then extract the image from the image using the image's image image image... Sorry... Essentially you'll want to grab the pixels that compose the image you want from the "combined" image image image. – Christian Stewart Feb 28 '13 at 21:42
  • Do you know the original dimensions of the images? For instance, if you combined a 16x16 and a 32x32 image with the method described in the linked question, you would end up with a 48x32 image, but have you saved the 16x16 and 32x32 dimensions, or do you only have the 48x32 image left? – Lasse V. Karlsen Feb 28 '13 at 21:43
  • The dimensions are known. But assume that the file's been saved into disk and is read as a bitmap by a separate program – dr_rk Feb 28 '13 at 21:45
  • If the splitting program has no prior knowledge of the original bitmaps, then you'd need some kind of heuristic to look for an all-white rectangular region in either the lower left corner or lower right corner. Once you've identified that, you should then be able to compute the rectangular regions of the original images. – mbeckish Feb 28 '13 at 21:49
  • I know dimensions of the images that were combined. – dr_rk Feb 28 '13 at 21:53

1 Answers1

2

Assuming that you know the sizes of the original bitmaps you can just clone a rectangle of the bitmap:

Bitmap bitmapLeft = bitmap.Clone(new Rectangle(0, 0, widthLeft, heightLeft), PixelFormat.DontCare);
Bitmap bitmapRight = bitmap.Clone(new Rectangle(widthLeft, 0, widthRight, heightRight), PixelFormat.DontCare);
pescolino
  • 3,086
  • 2
  • 14
  • 24