-
-
Save snickers2k/fdd9a7d7a0dc4e670b525ac4b09a75dc to your computer and use it in GitHub Desktop.
automatically overlaying two images, using Gimp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; script for automatically overlaying two images, | |
;; for comparison, in gimp. | |
;; | |
;; 1. save the file in your scripts directory | |
;; (/Applications/Gimp.app/Contents/MacOS/Resources/share/gimp/2.0/scripts/ or | |
;; /Users/[user]/Library/Application Support/GIMP/2.8/plug-ins on my mac) | |
;; 2. generate two images to compare | |
;; 3. run: | |
;; bash: /Applications/Gimp.app/Contents/MacOS/gimp-2.8 -b '(script-fu-overlay "image1.pdf" "image2.jpg")' | |
;; | |
;; image format is flexible, and can be anything gimp will import from | |
;; | |
;; Copyright 2013, Alex Ausch | |
;; Free to use under attribution license: http://creativecommons.org/licenses/by/2.0/ca/ | |
(define (script-fu-overlay img1 img2) | |
(let* | |
( | |
(position1 -1) | |
(position2 -2) | |
(back-layer nil) | |
(front-layer nil) | |
(width 0) | |
(height 0) | |
(image (car (gimp-image-new 10 10 RGB))) | |
(drawable (car (gimp-image-get-active-layer image))) | |
) | |
(set! back-layer(car(gimp-file-load-layer RUN-NONINTERACTIVE image img1))) | |
(set! front-layer(car(gimp-file-load-layer RUN-NONINTERACTIVE image img2))) | |
(set! width (car (gimp-drawable-width back-layer))) | |
(set! height (car (gimp-drawable-height back-layer))) | |
(gimp-image-resize image width height 0 0) | |
(gimp-image-insert-layer image back-layer 0 position1) | |
(gimp-image-insert-layer image front-layer 0 position2) | |
(gimp-layer-set-opacity front-layer 40) | |
(gimp-display-new image) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment