tried sending this through earlier but it was deemed too large.
I'm looking for some help with a batch file. A friend of mine got this working in windows with gthumb, to flicker two images over each other. Would there be anyway to convert this to a sh or bash file and get it running with gthumb 3.4.0 in Ubuntu 15.10?
but the images can't be aligned whilst the code below would do this.
echo %time%
SET steps=256
SET comparison_size=200
REM L ONH 700
SET x_start=800
REM L ONH 600
SET y_start=256
SET /a x_center=%x_start%
SET /a y_center=%y_start%
REM only need to make a single image for comparison
convert %1 -type grayscale -contrast -contrast -crop %comparison_size%x%comparison_size%+%x_center%+%y_center% img_1.tif
:next_step
SET best_avg=0
SET best_x=0
SET best_y=0
SET x_offset=-%steps%
:loopx
SET y_offset=-%steps%
:loopy
SET /a x_pos=%x_center%+%x_offset%
SET /a y_pos=%y_center%+%y_offset%
convert %2 -type grayscale -contrast -contrast -crop %comparison_size%x%comparison_size%+%x_pos%+%y_pos% img_2.tif
compare img_1.tif img_2.tif -highlight-color Black -lowlight-color White -compose Src comparison.tif
FOR /F "tokens=4 skip=1 delims=," %%i IN ('convert comparison.tif -scale 1x1 -depth 16 txt:-') DO SET this_avg=%%i
IF %this_avg% LEQ %best_avg% GOTO not_best
SET /a best_x=%x_offset%
SET /a best_y=%y_offset%
SET /a best_avg=%this_avg%
:not_best
SET /a y_offset=%y_offset%+%steps%
IF %y_offset% LEQ %steps% goto loopy
SET /a x_offset=%x_offset%+%steps%
IF %x_offset% LEQ %steps% goto loopx
SET /a x_center=%x_center%+%best_x%
SET /a y_center=%y_center%+%best_y%
echo %x_center%, %y_center%
SET /a steps=%steps%/2
IF %steps% GEQ 1 goto next_step
SET /a x_displacement=%x_center%-%x_start%
SET /a y_displacement=%y_center%-%y_start%
echo Best Match found at X : %x_displacement%, Y : %y_displacement%
echo %time%
echo Beginning image preparation
composite %1 trans.png circle.jpg first_image.png
convert -size 2160x1440 xc:white first_image.jpg
composite -geometry +%x_displacement%+%y_displacement% first_image.png first_image.jpg first_image.jpg
composite %2 trans.png circle.jpg second_image.png
convert -size 2160x1440 xc:white second_image.jpg
composite -geometry +0+0 second_image.png second_image.jpg second_image.jpg
echo %time%