Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
automatically overlaying two images, using Gimp
;; script for automatically overlaying two images,
;; for comparison, in gimp.
;; 1. save the file in your scripts directory
;; (/Applications/ or
;; /Users/[user]/Library/Application Support/GIMP/2.8/plug-ins on my mac)
;; 2. generate two images to compare
;; 3. run:
;; bash: /Applications/ -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:
(define (script-fu-overlay img1 img2)
(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
You can’t perform that action at this time.