2

Context (can be skipped)

So maybe I am asking the wrong question for my problem. So let me start by explaining where my question comes from. Maybe this description also helps users that try to do the same thing to find this Q&A.

I have a Whatsapp thread on my mobile that I want to preserve as one big image. On my laptop I would use FastStone Capture to capture a scrolling screenshot, but on my mobile this is a bit difficult. So what I did so far is:

  • I changed my whatsapp background to some uniform colour
  • made many screenshots in landscape mode using build in Android functionality, each time scrolling a bit and making a screenshot, making sure there was some overlap
  • transferred those to my laptop
  • stripped the titlebar and text entry bar (including the little gradient effect close to those bars) using ImageMagick on cygwin:

    mogrify -crop 1920x717\!-0+208 +repage Screenshot_*

  • with slight modification for the first and last image to preserve the top and bottom:

    mogrify -crop 1920x925\!-0-0 +repage ScreenshotFirst_*

    mogrify -crop 1920x872\!-0+208 +repage ScreenshotLast_*

Now my problem is that the overlap for those images is not constant.

The Question

How can I combine two images with ImageMagick, when the bottom part of the first image is exactly the same as the bottom part of the second image?

How can I combine

AAAAAAAAAA
BBBBBBBBBB
CCCCCCCCCC

and

CCCCCCCCCC
DDDDDDDDDD
EEEEEEEEEE
FFFFFFFFFF

into

AAAAAAAAAA
BBBBBBBBBB
CCCCCCCCCC
DDDDDDDDDD
EEEEEEEEEE
FFFFFFFFFF

?

In addition to above ASCII-art here a real-life example. Considering these 3 screenshots:

Now I would like to be able to combine these into one image with (preferable command line) open source tooling. As you see the amount of overlap between the images varies. The result should look like this:

(Failed) idea's on solution

I spend a full day searching, fully convinced that this should already be possible, that I was just overlooking the commands. I have not found it. The ImageMagick documentation and examples are super, the forums quite complete and helpful and Fred's Scripts is a good place to know when working with ImageMagic, but nothing on this (or similar) problem.

I have tried 'abusing' hudin for this, but did not get it to work (also not with the help of http://ubuntuforums.org/showthread.php?t=1856395&highlight=imagemagick%20panorama )

Any approach on how to do this is more then welcome.

pjvleeuwen
  • 4,215
  • 1
  • 18
  • 31
  • Try posting a few such images and I will have a try if it is still relevant. – Mark Setchell Dec 06 '14 at 22:25
  • Hi @MarkSetchell , thanks for responding. The issue not that urgent anymore :-), but I am still interested in how to do this with command line tooling. I added some links to example images to the question. I am interested on your take on it. Cheers. – pjvleeuwen Jan 13 '15 at 21:16
  • 1
    I actually answered a very similar question a little while back that I am sure you can adapt.. and maybe even vote for :-) http://stackoverflow.com/questions/16219402/algorithm-to-detect-overlapping-rows-of-two-images/27342865#27342865 – Mark Setchell Jan 13 '15 at 21:41
  • Thanks @MarkSetchell that answer is indeed at least relevant, especially since it is a bash solution. The example on how you use the convert tool can be useful in other situations. I would have to find some time to play with it, but for now thanks for pointing it out. – pjvleeuwen Jan 15 '15 at 07:23

1 Answers1

0

It seems a good idea to remove the uniform coloured background from the screenshots:

mogrify -transparent '#e8ecf3' +repage Screenshot*

After doing so it seems that I need to strip a little more from the top because of the gradient effect (sizes based on my Galaxy S4 screensize and current installed whatsapp dimensions):

mogrify -crop 1920x925\!-0-0 +repage ScreenshotFirst_*
mogrify -crop 1920x858\!-0+222 +repage ScreenshotLast_*
mogrify -crop 1920x703\!-0+222 +repage Screenshot_*

Now these images should be processable by the script discussed here: http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=22526

Starting with two images that I know have overlap (with verbose output) like:

./overlap.v4.sh -v Screenshot_2013-09-22-10-55-36.png Screenshot_2013-09-22-10-55-55.png

This after running for 3 hours it was still not finished (working on 15th comparison point). With > 40 screenshots this is not very good. I will explore this path further by trying to modify the script by specifically trying to match the top and bottom parts of the images. I will post back my results.

In the mean time all ideas are still welcome.

pjvleeuwen
  • 4,215
  • 1
  • 18
  • 31