Page 1 of 1
Rejoin tiles that overlap...
Posted: 2014-01-22T15:57:37-07:00
by afre
Been using ImageMagick for some time. A steep learning curve but rewarding I suppose. My computer isn't very powerful, so I cut my images before I process them. I am wondering if there is a simple way to rejoin tiles that overlap. E.g., to undo:
I end up having to crop the edges before using montage to reconstitute the image, which isn't very straightforward. It would also be nice if I could blend or even interpolate the overlapping pixels, but that would be asking for too much.
~afre
Re: Rejoin tiles that overlap...
Posted: 2014-01-22T16:23:27-07:00
by fmw42
If you crop without the +repage so the virtual canvas geometry is kept, then you can just flatten or possibly mosaic all the tiles to get back your image.
convert lena.png -crop 2x2+0+2@ lena_%d.png
convert lena_0.png lena_1.png lena_2.png lena_3.png -background black -flatten lena_recovered.png
Re: Rejoin tiles that overlap...
Posted: 2014-01-22T16:56:47-07:00
by afre
I will give it a try. Thanks.
Re: Rejoin tiles that overlap...
Posted: 2014-01-22T18:21:52-07:00
by fmw42
If all your files are in one folder and no others that are named as lena_xxx.png, then you can do
convert lena_*.png -background black -flatten lena_recovered.png
Note, this does not work with jpg, since jpg does not keep any virtual canvas information.
Re: Rejoin tiles that overlap...
Posted: 2014-01-23T10:32:56-07:00
by afre
BTW, I am not using IM to process the tiles, so the virtual canvas isn't preserved. I am not successful in reapplying this info though.
Code: Select all
$ identify -set page 4280x2854+2140+1426 L1077429_3d.png
L1077429_3d.png PNG 2140x1428 4280x2854+2140+1426 8-bit DirectClass 2.439MB 0.000u 0:00.000
$ identify -format %g L1077429_3d.png
2140x1428+0+0
Re: Rejoin tiles that overlap...
Posted: 2014-01-23T11:11:21-07:00
by fmw42
I am afraid you are out of luck if the virtual canvas data is missing, unless you know exactly how to put them back together using -page xxx image1 -page ... image2 -flatten.
see
http://www.imagemagick.org/Usage/layers/#flatten
In identify -verbose yourimage, what do you see from Page Geometry. If the value always has +0+0, then you have no virtual canvas data preserved.
Re: Rejoin tiles that overlap...
Posted: 2014-01-25T15:25:37-07:00
by afre
-page xxx image1 -page ... image2 -flatten
Thanks for the tip. I got it working by redirecting the geometry.
~afre