1

Suppose you have several small images, all cropped from a single large image. Each small image is some subrectangle of the large image. The small images have sufficient overlap with each other. However, you don't have the large image: given the small images, how do you recover the large image? Is there software to automate this?

Assume we are dealing with lossless image formats such as PNG. There is no rotation, perspective distortion, or any other fuzzing involved, each input image is an exact crop of the desired output image.

Somewhat more precisely, find an image X, possibly with some "blank" pixels, such that:

  • Every input image is a subrectangle of X.
  • Every pixel of X is either "blank" or comes from at least one of the input images.
  • X is "as small as possible".

The first two requirements are precise, I have not made the third one perfectly precise. The third requirement is to rule out trivial solutions such as simply putting the input images side-by-side in some order. Blank pixels are allowed since the input images may not line up perfectly to form a rectangle. For example, if the inputs are

ABC      EFG
DEF      HIJ

I'd expect the output to be

ABC
DEFG
 HIJ

(Here each letter represents a pixel of a specific colour. For example perhaps each A is a white pixel, each B is a black pixel, and so on.)

A use case is combining several screenshots of something which you can pan (such as a map or a game).

A brief Google search did not yield software to do this. There are panorama-stitching tools like Hugin, but they are "too intelligent" and I'm not sure if they can be made to satisfy the "every input image must be an exact crop of the output" requirement.

closed as unclear what you're asking by Ƭᴇcʜιᴇ007, DavidPostill, mdpc, Kevin Panko, CharlieRB Apr 10 '15 at 18:49

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Just use an image editor like Photoshop or GIMP. Create a large canvas the size you need plus some working room. Open the images, each in a separate layer. Then position each one. Where there is overlap, you can temporarily make the top image semi-transparent to align them. When everything is in place, flatten the image and crop. – fixer1234 Apr 10 '15 at 5:31
  • Yes, but that would need precise, fine alignment. Probably with a lot of zooming in and out, careful mouse movements, and stuff like that. I'd like to find software to automate all this manual work for me. – Prateek Apr 11 '15 at 21:28
  • I'm curious why this was put on hold. I thought it was fairly clear what was being asked, in fact with more mathematical precision than needed. – Prateek Apr 11 '15 at 21:41
  • I looked up the How to ask page, and this seems to follow the guidelines: Search and research: It says Hugin etc were considered and not found suitable. Be on topic: asking for a software recommendation, or a clever way to use some software (let me know if this is not on-topic). Be specific: Seems specific enough, describing the problem in detail. Make it relevant to others: Example use case is given. I hope it is clear. Keep an open mind: I don't think the question contradicts that. :-) – Prateek Apr 11 '15 at 21:42
  • What I described in my comment is a solution, and yes, it can be a bit of work. If you are looking for software to do this automatically, requesting product recommendations is off-topic (superuser.com/help/on-topic). Plus you seem to have very specific requirements in mind, so you would be in the best position to research what's available and weight the options. – fixer1234 Apr 11 '15 at 22:01