Created
September 6, 2017 11:52
-
-
Save JackDesBwa/c44554d1f1a98eac892790e4bf774dbc to your computer and use it in GitHub Desktop.
This file contains 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
;;; | |
;;; COLOGRAM.SCM -*-scheme-*- This File is written by Friedemann Wolpert 2010 | |
;;; You can contact the Author using the following eMail: Friedemann@MedienKunstOnline.De | |
;;; Project Entry for "Mach Flott den Schrott 2", Heise Magazin | |
; | |
; Found on MedienKunstOnline.De thanks to the Wayback Machine : | |
; https://web.archive.org/web/20150502123253/http://medienkunstonline.de:80/Cologram_Uk.scm | |
(define (script-fu-cologram image layer rows-per-sec dpi-setting img-resize want-sharpen want-grid want-adjframe frameforecolor framerearcolor adjframedist adjframewidth want-cutframe cutframedist cutframewidth | |
;anchor-top anchor-down anchor-left anchor-right format | |
) | |
(let* ( | |
(width (car (gimp-image-width image))) | |
(height (car (gimp-image-height image))) | |
(mode 0) (l 0) (y 0) (y2) | |
(layerinfo (gimp-image-get-layers image)); needed for amount of Layers | |
(num-layers (car layerinfo)) | |
(layers (cadr layerinfo)) | |
(width2 (* width num-layers)) ; ; width2 = width * num-layers reversed | |
(new-image) (new-layer) (floating-layer) (want-alpha) | |
(grid-layer) | |
(dpi-value) | |
(Target-Width) | |
(Target-Height) | |
(scaleval) | |
) | |
; --- create new image | |
(set! new-image (car (gimp-image-new width height mode))) | |
; --- start undo Group Cologram (new-image) | |
(gimp-image-undo-group-start new-image); No History for generated Image | |
(gimp-image-undo-group-start image); No History for generated Image | |
; -- Set Default Colors | |
(gimp-context-set-default-colors) | |
; reset Brush Sizes !!! | |
; --- Set Resolution to selected DPI Setting; place up | |
(cond | |
(( equal? dpi-setting 0 ) | |
(set! dpi-value 300) | |
) | |
(( equal? dpi-setting 1 ) | |
(set! dpi-value 150) | |
) | |
(( equal? dpi-setting 2 ) | |
(set! dpi-value 180) | |
) | |
(( equal? dpi-setting 3 ) | |
(set! dpi-value 300) | |
) | |
(( equal? dpi-setting 4 ) | |
(set! dpi-value 360) | |
) | |
(( equal? dpi-setting 5 ) | |
(set! dpi-value 600) | |
) | |
(( equal? dpi-setting 6 ) | |
(set! dpi-value 720) | |
) | |
) | |
; img-resize - if value not 0 then resize image depending on DPI settings !!! reset width and height afterwards | |
; | |
; "0 = No Changes (Default)" "1 = US-LETTER" "2 = US-LEGAL" "3 = Din A3" "4 = Din A4" "5 = Din A5" "6 = Din A6") | |
; | |
(cond ; make sure to subtract the frame and cutmark width !!! - you can eval portrait or landscape depending on width > height or vv. | |
(( equal? img-resize 1 ) ; 1 == US-LETTER 8.5 x 11 inch differ between (portrait & landscape) | |
(cond ( (< width height) ; width < height -> Height > Width -> Portrait | |
;Set Target Size | |
(set! Target-Width (* 8.5 dpi-value)) ; US LETTER Portrait | |
(set! Target-Height (* 11 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Height height)) ; We want a proportional Image | |
(set! Target-Width (* width scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; US LETTER | |
(cond ( (> width height) ; Landscape | |
;Set Target Size | |
(set! Target-Height (* 8.5 dpi-value)) ; US LETTER Landscape | |
(set! Target-Width (* 11 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
) | |
) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; US LETTER SQUARE | |
(cond((= width height) ; Square Format - use Landscape for Better Resolution | |
;Set Target Size | |
(set! Target-Height (* 8.5 dpi-value)) ; US LETTER Landscape | |
(set! Target-Width (* 11 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
) | |
) | |
; ------------------------------ | |
; Valid for all Target Sizes !!! | |
; ------------------------------ | |
; reset width / height value !!! | |
(set! width Target-Width) | |
(set! height Target-Height) | |
; Scale Source Image to desired Size | |
(gimp-image-scale-full image Target-Width Target-Height 3) ; 2 cubic 3 lancosz | |
; -- Resize the Image accordingly adjframewidth 8.5 x 11" x dpi-value | |
(gimp-image-scale new-image Target-Width Target-Height) ; Scale Source Images Up ! | |
(set! width2 (* width num-layers)) | |
(cond ; -- Sharpen all Layers | |
(( equal? want-sharpen TRUE ) | |
(set! l 0); l=0; | |
(while (< l num-layers); want-sharpen | |
(plug-in-unsharp-mask 0 image (aref layers l) 1 10 10) | |
(set! l (+ l 1)) ; l = l + 1 | |
) | |
) | |
) ; want sharpen | |
) ; end US LETTER | |
; -- START US LEGAL | |
(( equal? img-resize 2 ) ; 2 == US-LEGAL 8.5 x 14 inch differ between (portrait/landscape/square) | |
(cond ( (< width height) ; width < height -> Height > Width -> Portrait | |
;Set Target Size | |
(set! Target-Width (* 8.5 dpi-value)) ; US LEGAL Portrait | |
(set! Target-Height (* 14 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Height height)) ; We want a proportional Image | |
(set! Target-Width (* width scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; US LEGAL | |
(cond ( (> width height) ; Landscape | |
;Set Target Size | |
(set! Target-Width (* 14 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 8.5 dpi-value)) ; US LEGAL Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
) | |
) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; US LEGAL SQUARE | |
(cond((= width height) ; Square Format - use Landscape for Better Resolution | |
;Set Target Size | |
(set! Target-Width (* 14 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 8.5 dpi-value)) ; US LEGAL Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
) | |
) | |
; ------------------------------ | |
; Valid for all Target Sizes !!! | |
; ------------------------------ | |
; reset width / height value !!! | |
(set! width Target-Width) | |
(set! height Target-Height) | |
; Scale Source Image to desired Size | |
(gimp-image-scale-full image Target-Width Target-Height 3) ; 2 cubic 3 lancosz | |
; -- Resize the Image accordingly adjframewidth 8.5 x 11" x dpi-value | |
(gimp-image-scale new-image Target-Width Target-Height) ; Scale Source Images Up ! | |
(set! width2 (* width num-layers)) | |
(cond ; -- Sharpen all Layers | |
(( equal? want-sharpen TRUE ) | |
(set! l 0); l=0; | |
(while (< l num-layers); want-sharpen | |
(plug-in-unsharp-mask 0 image (aref layers l) 1 10 10) | |
(set! l (+ l 1)) ; l = l + 1 | |
) | |
) | |
) ; want sharpen | |
) ; end US LEGAL | |
; --- Start Din A3 !!! | |
(( equal? img-resize 3 ) ; 3 == Din-A3 11.69 x 16.54 inch differ between (portrait/landscape/square) | |
(cond ( (< width height) ; width < height -> Height > Width -> Portrait | |
;Set Target Size | |
(set! Target-Width (* 11.69 dpi-value)) ; Din A3 Portrait | |
(set! Target-Height (* 16.54 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Height height)) ; We want a proportional Image | |
(set! Target-Width (* width scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A3 | |
(cond ( (> width height) ; Landscape | |
;Set Target Size | |
(set! Target-Width (* 16.54 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 11.69 dpi-value)) ; Din A3 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
) | |
) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A3 SQUARE | |
(cond((= width height) ; Square Format - use Landscape for Better Resolution | |
;Set Target Size | |
(set! Target-Width (* 16.54 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 11.69 dpi-value)) ; Din A3 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
) | |
) | |
; ------------------------------ | |
; Valid for all Target Sizes !!! | |
; ------------------------------ | |
; reset width / height value !!! | |
(set! width Target-Width) | |
(set! height Target-Height) | |
; Scale Source Image to desired Size | |
(gimp-image-scale-full image Target-Width Target-Height 3) ; 2 cubic 3 lancosz | |
; -- Resize the Image accordingly adjframewidth 8.5 x 11" x dpi-value | |
(gimp-image-scale new-image Target-Width Target-Height) ; Scale Source Images Up ! | |
(set! width2 (* width num-layers)) | |
(cond ; -- Sharpen all Layers | |
(( equal? want-sharpen TRUE ) | |
(set! l 0); l=0; | |
(while (< l num-layers); want-sharpen | |
(plug-in-unsharp-mask 0 image (aref layers l) 1 10 10) | |
(set! l (+ l 1)) ; l = l + 1 | |
) | |
) | |
) ; want sharpen | |
) ; end Din A3 | |
; --- Start Din A4 !!! | |
(( equal? img-resize 4 ) ; 4 == Din-A4 8.27 x 11.69 inch differ between (portrait/landscape/square) | |
(cond ( (< width height) ; width < height -> Height > Width -> Portrait | |
;Set Target Size | |
(set! Target-Width (* 8.27 dpi-value)) ; Din A4 Portrait | |
(set! Target-Height (* 11.69 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Height height)) ; We want a proportional Image | |
(set! Target-Width (* width scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A4 | |
(cond ( (> width height) ; Landscape | |
;Set Target Size | |
(set! Target-Width (* 11.69 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 8.27 dpi-value)) ; Din A4 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
) | |
) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A4 SQUARE | |
(cond((= width height) ; Square Format - use Landscape for Better Resolution | |
;Set Target Size | |
(set! Target-Width (* 11.69 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 8.27 dpi-value)) ; Din A4 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
) | |
) | |
; ------------------------------ | |
; Valid for all Target Sizes !!! | |
; ------------------------------ | |
; reset width / height value !!! | |
(set! width Target-Width) | |
(set! height Target-Height) | |
; Scale Source Image to desired Size | |
(gimp-image-scale-full image Target-Width Target-Height 3) ; 2 cubic 3 lancosz | |
; -- Resize the Image accordingly adjframewidth 8.5 x 11" x dpi-value | |
(gimp-image-scale new-image Target-Width Target-Height) ; Scale Source Images Up ! | |
(set! width2 (* width num-layers)) | |
(cond ; -- Sharpen all Layers | |
(( equal? want-sharpen TRUE ) | |
(set! l 0); l=0; | |
(while (< l num-layers); want-sharpen | |
(plug-in-unsharp-mask 0 image (aref layers l) 1 10 10) | |
(set! l (+ l 1)) ; l = l + 1 | |
) | |
) | |
) ; want sharpen | |
) ; end Din A4 | |
; --- Start Din A5 !!! | |
(( equal? img-resize 5 ) ; 5 == Din-A5 5.83 x 8.27 inch differ between (portrait/landscape/square) | |
(cond ( (< width height) ; width < height -> Height > Width -> Portrait | |
;Set Target Size | |
(set! Target-Width (* 5.83 dpi-value)) ; Din A5 Portrait | |
(set! Target-Height (* 8.27 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Height height)) ; We want a proportional Image | |
(set! Target-Width (* width scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A5 | |
(cond ( (> width height) ; Landscape | |
;Set Target Size | |
(set! Target-Width (* 8.27 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 5.83 dpi-value)) ; Din A5 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
) | |
) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A5 SQUARE | |
(cond((= width height) ; Square Format - use Landscape for Better Resolution | |
;Set Target Size | |
(set! Target-Width (* 8.27 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 5.83 dpi-value)) ; Din A5 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
) | |
) | |
; ------------------------------ | |
; Valid for all Target Sizes !!! | |
; ------------------------------ | |
; reset width / height value !!! | |
(set! width Target-Width) | |
(set! height Target-Height) | |
; Scale Source Image to desired Size | |
(gimp-image-scale-full image Target-Width Target-Height 3) ; 2 cubic 3 lancosz | |
; -- Resize the Image accordingly adjframewidth 8.5 x 11" x dpi-value | |
(gimp-image-scale new-image Target-Width Target-Height) ; Scale Source Images Up ! | |
(set! width2 (* width num-layers)) | |
(cond ; -- Sharpen all Layers | |
(( equal? want-sharpen TRUE ) | |
(set! l 0); l=0; | |
(while (< l num-layers); want-sharpen | |
(plug-in-unsharp-mask 0 image (aref layers l) 1 10 10) | |
(set! l (+ l 1)) ; l = l + 1 | |
) | |
) | |
) ; want sharpen | |
) ; end Din A5 | |
; --- Start Din A6 !!! | |
(( equal? img-resize 6 ) ; 6 == Din-A6 4.13 x 5.83 inch differ between (portrait/landscape/square) | |
(cond ( (< width height) ; width < height -> Height > Width -> Portrait | |
;Set Target Size | |
(set! Target-Width (* 4.13 dpi-value)) ; Din A6 Portrait | |
(set! Target-Height (* 5.83 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Height height)) ; We want a proportional Image | |
(set! Target-Width (* width scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A6 | |
(cond ( (> width height) ; Landscape | |
;Set Target Size | |
(set! Target-Width (* 5.83 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 4.13 dpi-value)) ; Din A6 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
) | |
) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A6 SQUARE | |
(cond((= width height) ; Square Format - use Landscape for Better Resolution | |
;Set Target Size | |
(set! Target-Width (* 5.83 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 4.13 dpi-value)) ; Din A6 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
) | |
) | |
; ------------------------------ | |
; Valid for all Target Sizes !!! | |
; ------------------------------ | |
; reset width / height value !!! | |
(set! width Target-Width) | |
(set! height Target-Height) | |
; Scale Source Image to desired Size | |
(gimp-image-scale-full image Target-Width Target-Height 3) ; 2 cubic 3 lancosz | |
; -- Resize the Image accordingly adjframewidth 8.5 x 11" x dpi-value | |
(gimp-image-scale new-image Target-Width Target-Height) ; Scale Source Images Up ! | |
(set! width2 (* width num-layers)) | |
(cond ; -- Sharpen all Layers | |
(( equal? want-sharpen TRUE ) | |
(set! l 0); l=0; | |
(while (< l num-layers); want-sharpen | |
(plug-in-unsharp-mask 0 image (aref layers l) 1 10 10) | |
(set! l (+ l 1)) ; l = l + 1 | |
) | |
) | |
) ; want sharpen | |
) ; end Din A6 | |
; --- Start Din A7 !!! | |
(( equal? img-resize 7 ) ; 7 == Din-A7 2.91 x 4.13 inch differ between (portrait/landscape/square) | |
(cond ( (< width height) ; width < height -> Height > Width -> Portrait | |
;Set Target Size | |
(set! Target-Width (* 2.91 dpi-value)) ; Din A7 Portrait | |
(set! Target-Height (* 4.13 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Height height)) ; We want a proportional Image | |
(set! Target-Width (* width scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A7 | |
(cond ( (> width height) ; Landscape | |
;Set Target Size | |
(set! Target-Width (* 4.13 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 2.91 dpi-value)) ; Din A7 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
) | |
) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A7 SQUARE | |
(cond((= width height) ; Square Format - use Landscape for Better Resolution | |
;Set Target Size | |
(set! Target-Width (* 4.13 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 2.91 dpi-value)) ; Din A7 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
) | |
) | |
; ------------------------------ | |
; Valid for all Target Sizes !!! | |
; ------------------------------ | |
; reset width / height value !!! | |
(set! width Target-Width) | |
(set! height Target-Height) | |
; Scale Source Image to desired Size | |
(gimp-image-scale-full image Target-Width Target-Height 3) ; 2 cubic 3 lancosz | |
; -- Resize the Image accordingly adjframewidth 8.5 x 11" x dpi-value | |
(gimp-image-scale new-image Target-Width Target-Height) ; Scale Source Images Up ! | |
(set! width2 (* width num-layers)) | |
(cond ; -- Sharpen all Layers | |
(( equal? want-sharpen TRUE ) | |
(set! l 0); l=0; | |
(while (< l num-layers); want-sharpen | |
(plug-in-unsharp-mask 0 image (aref layers l) 1 10 10) | |
(set! l (+ l 1)) ; l = l + 1 | |
) | |
) | |
) ; want sharpen | |
) ; end Din A7 | |
; --- Start Din A8 !!! | |
(( equal? img-resize 8 ) ; 8 == Din-A8 2.05 x 2.91 inch differ between (portrait/landscape/square) | |
(cond ( (< width height) ; width < height -> Height > Width -> Portrait | |
;Set Target Size | |
(set! Target-Width (* 2.05 dpi-value)) ; Din A8 Portrait | |
(set! Target-Height (* 2.91 dpi-value)) ; Scale Factor | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Height height)) ; We want a proportional Image | |
(set! Target-Width (* width scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A8 | |
(cond ( (> width height) ; Landscape | |
;Set Target Size | |
(set! Target-Width (* 2.91 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 2.05 dpi-value)) ; Din A8 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
) | |
) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
)) | |
; Din A8 SQUARE | |
(cond((= width height) ; Square Format - use Landscape for Better Resolution | |
;Set Target Size | |
(set! Target-Width (* 2.91 dpi-value)) ; Scale Factor | |
(set! Target-Height (* 2.05 dpi-value)) ; Din A8 Landscape | |
; check if want cutframe & want adjframe | |
(cond | |
(( equal? want-adjframe TRUE ) | |
(cond ; still fits Image ? | |
((< (* (+ adjframewidth adjframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ adjframewidth adjframedist) 2)) ) | |
)) | |
(set! scaleval (/ Target-Width width)) ; We want a proportional Image | |
(set! Target-Height (* height scaleval)) | |
)) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Height ) | |
(set! Target-Height (- Target-Height (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
(cond | |
((< (* (+ cutframewidth cutframedist) 2) Target-Width ) | |
(set! Target-Width (- Target-Width (* (+ cutframewidth cutframedist) 2)) ) | |
)) | |
)) | |
) | |
) | |
; ------------------------------ | |
; Valid for all Target Sizes !!! | |
; ------------------------------ | |
; reset width / height value !!! | |
(set! width Target-Width) | |
(set! height Target-Height) | |
; Scale Source Image to desired Size | |
(gimp-image-scale-full image Target-Width Target-Height 3) ; 2 cubic 3 lancosz | |
; -- Resize the Image accordingly adjframewidth 8.5 x 11" x dpi-value | |
(gimp-image-scale new-image Target-Width Target-Height) ; Scale Source Images Up ! | |
(set! width2 (* width num-layers)) | |
(cond ; -- Sharpen all Layers | |
(( equal? want-sharpen TRUE ) | |
(set! l 0); l=0; | |
(while (< l num-layers); want-sharpen | |
(plug-in-unsharp-mask 0 image (aref layers l) 1 10 10) | |
(set! l (+ l 1)) ; l = l + 1 | |
) | |
) | |
) ; want sharpen | |
) ; end Din A8 | |
) ; end Target Size | |
; Clear Selection | |
(gimp-selection-none image) | |
(gimp-display-new new-image) ; show it! | |
(set! new-layer (car (gimp-layer-new new-image width height RGB-IMAGE "Cologram" 100 NORMAL-MODE))) | |
(gimp-image-add-layer new-image new-layer 0) | |
(gimp-image-set-active-layer new-image new-layer) | |
; (set! want-alpha (car (gimp-drawable-has-alpha layer))) ; only works if no alpha layer ... | |
; (if (= want-alpha TRUE) ; bugged | |
; (gimp-layer-add-alpha new-layer image ) ; remove the alpha channel ... add white as background ... | |
; (gimp-layer-flatten layer) RGBA->RGB removes Alpha from a Layer | |
; iterate all layers & flatten (if required at all !!!) | |
; ) | |
; -- Set Palette for adjustment Layer | |
(gimp-edit-fill new-layer BG-IMAGE-FILL) | |
; else transparent Alpha Channel gets Black instead of translucent | |
; --- copy each section, could be improved - minor bugs (does use same row for all slices) | |
(set! y 0) ; y = 0; | |
(set! y2 0) ; y2 = 0; | |
;(while (< y (- width num-layers)) ; while y < (width + 1) - Bug Here !!! One Step too far | |
(while (< y width) | |
;(gimp-rect-select image y 0 rows-per-sec height 2 0 0); one slice rows-per-sec in Width - Height in Height | |
(set! l 0); l=0; | |
(while (< l num-layers); while l < 5 (eg 5 Layers), iterate through all layers | |
(gimp-rect-select image y 0 rows-per-sec height 2 0 0); one slice rows-per-sec in Width - Height in Height | |
(gimp-edit-copy (aref layers l)) ; copy current layer l | |
(set! floating-layer (car (gimp-edit-paste new-layer FALSE))) ; | |
; Now, move scale and anchor it | |
(gimp-floating-sel-to-layer floating-layer) | |
(gimp-layer-set-offsets floating-layer y2 0) | |
(set! y2 (+ y2 rows-per-sec)) ; y2 = y2 + rows-per-sec | |
(set! l (+ l 1)) ; l = l + 1 | |
(set! y (+ y rows-per-sec)) | |
) | |
;(set! y (+ y (* num-layers rows-per-sec))) ; y = y + ( num-layers * rows-per-sec ) | |
) | |
(gimp-drawable-update new-layer 0 0 width height) | |
(set! new-layer (car(gimp-image-merge-visible-layers new-image 1))) ; reset to new Value ! | |
; Drawing the Barrier Grid - This Section depends on your Gimp Version and may need Adjustment | |
(cond | |
(( equal? want-grid TRUE ) | |
; -- Initiate Grid Layer | |
(set! grid-layer (car(gimp-layer-new new-image (car (gimp-image-width new-image)) (car (gimp-image-height new-image)) 1 "Barrier Grid" 100 NORMAL))) | |
(gimp-image-add-layer new-image grid-layer 0) | |
(gimp-edit-clear grid-layer) | |
; -- Set Default Colors | |
(gimp-context-set-default-colors) | |
; --- Draw Grid Layer ' uses plug-in-grid for huge performance boost !!! | |
; Start Offset For Alignment of Grid and Image ||-> Todo | |
(set! y (* rows-per-sec ( / (- num-layers 1 ) 2 ))) ; y = rows-per-sec * (numlayers-1)/2 | |
; Attention: There is a Bug in plug-in-grid you may need to adopt the Script depending on your Gimp Version | |
;(plug-in-grid run-mode image drawable hwidth hspace hoffset hcolor hopacity vwidth vspace voffset vcolor vopacity iwidth ispace ioffset icolor iopacity) | |
;For Gimp >= 2.6.7 use this Line | |
(plug-in-grid 1 new-image grid-layer 0 1 0 '(0 0 0) 0 (- (* rows-per-sec num-layers) rows-per-sec) (* rows-per-sec num-layers) 0 '(0 0 0) 255 0 0 0 '(0 0 0) 255) ; non-interactive=1 | |
;For Gimp < 2.6.7 use this Line | |
; (plug-in-grid 1 new-image grid-layer 0 (* rows-per-sec num-layers) 0 '(0 0 0) 0 (- (* rows-per-sec num-layers) rows-per-sec) 1 y '(0 0 0) 255 0 0 0 '(0 0 0) 255) ; non-interactive=1 | |
; --- No Selection | |
(gimp-selection-none new-image) | |
(gimp-selection-none image) | |
; --- Flip Grid Layer | |
(gimp-flip grid-layer 1) ; Vertical Flip for perfect alignment ! | |
) | |
) | |
; Want an adjustment Frame | |
(cond | |
(( equal? want-adjframe TRUE ) | |
; Draw a Rect Frame with required Sizes ! | |
; -- Resize the Image accordingly adjframedist adjframewidth | |
(gimp-image-resize new-image (+ width (* adjframedist 2)) (+ height (* adjframedist 2)) adjframedist adjframedist); resize & center | |
; Ebene auf Bildgr�sse | |
(gimp-layer-resize-to-image-size new-layer) ; Cologram Layer | |
(cond | |
(( equal? want-grid TRUE ) | |
(gimp-layer-resize-to-image-size grid-layer) ; | |
)) | |
; reset width / height value !!! | |
(set! width (car (gimp-image-width new-image))) | |
(set! height (car (gimp-image-height new-image))) | |
(gimp-selection-all new-image) | |
; -- Resize the Image accordingly adjframewidth | |
(gimp-image-resize new-image (+ width (* adjframewidth 2))(+ height (* adjframewidth 2)) adjframewidth adjframewidth ) | |
; Rahmen auf Bildgr�sse | |
(gimp-layer-resize-to-image-size new-layer) ; Cologram Layer | |
(cond | |
(( equal? want-grid TRUE ) | |
(gimp-layer-resize-to-image-size grid-layer) | |
)) | |
; Now invert selection and fill it ! | |
(gimp-selection-invert new-image) | |
; -- Set Palette for adjustment Layer | |
(gimp-context-set-foreground frameforecolor) | |
(gimp-context-set-background framerearcolor) | |
(gimp-edit-fill new-layer BG-IMAGE-FILL) | |
(cond | |
(( equal? want-grid TRUE ) | |
(gimp-edit-fill grid-layer FG-IMAGE-FILL) | |
)) | |
; Reset Palette | |
(gimp-context-set-default-colors) | |
; reset width / height value !!! | |
(set! width (car (gimp-image-width new-image))) | |
(set! height (car (gimp-image-height new-image))) | |
) | |
) | |
(gimp-selection-none new-image) | |
; ---- Want a Cut Frame (No Need for Color here) | |
(cond | |
(( equal? want-cutframe TRUE ) | |
; Draw a Rect Frame with required Sizes ! | |
; -- Resize the Image accordingly cutframedist cutframewidth | |
(gimp-image-resize new-image (+ width (* cutframedist 2)) (+ height (* cutframedist 2)) cutframedist cutframedist); resize & center | |
; Ebene auf Bildgr�sse | |
(gimp-layer-resize-to-image-size new-layer) ; Cologram Layer | |
(cond | |
(( equal? want-grid TRUE ) | |
(gimp-layer-resize-to-image-size grid-layer) | |
)) | |
; reset width / height value !!! | |
(set! width (car (gimp-image-width new-image))) | |
(set! height (car (gimp-image-height new-image))) | |
(gimp-selection-all new-image) | |
; -- Resize the Image accordingly cutframewidth | |
(gimp-image-resize new-image (+ width (* cutframewidth 2))(+ height (* cutframewidth 2)) cutframewidth cutframewidth) | |
; Rahmen auf Bildgr�sse | |
(gimp-layer-resize-to-image-size new-layer) ; Cologram Layer | |
(cond | |
(( equal? want-grid TRUE ) | |
(gimp-layer-resize-to-image-size grid-layer) | |
)) | |
; Now invert selection and fill it ! | |
(gimp-selection-invert new-image) | |
(gimp-edit-fill new-layer FG-IMAGE-FILL) | |
(cond | |
(( equal? want-grid TRUE ) | |
(gimp-edit-fill grid-layer FG-IMAGE-FILL) | |
)) | |
; Reset Palette | |
(gimp-context-set-default-colors) | |
; reset width / height value !!! | |
(set! width (car (gimp-image-width new-image))) | |
(set! height (car (gimp-image-height new-image))) | |
(gimp-selection-none new-image) | |
) | |
) | |
; --- Draw Register Marks depending on chosen Size (and DPI Values) | |
;(cond | |
; (( equal? format 0) ; Default size | |
;(gimp-image-set-resolution new-image 150 150) ; Canon Printer 600, Epson 720 dpi | |
;(gimp-message "Default Format") | |
; ) | |
; (( equal? format 1) ; Want Din-A4 size | |
;(gimp-image-set-resolution new-image 180 180) ; Canon Printer 600, Epson 720 dpi | |
;(gimp-message "Want Din-A4") | |
;(gimp-image-resize ... ) | |
; ) | |
;) | |
; --- Draw Register Marks | |
;(cond | |
; (( equal? anchor-top TRUE ) | |
;(gimp-image-set-resolution new-image 150 150) ; Canon Printer 600, Epson 720 dpi | |
;(gimp-message "Anchor Points wanted") | |
; ) | |
;) | |
;(cond | |
; (( equal? anchor-down TRUE ) | |
;(gimp-image-set-resolution new-image 150 150) ; Canon Printer 600, Epson 720 dpi | |
;(gimp-message "Anchor Points wanted") | |
; ) | |
; (( equal? anchor-down FALSE ) | |
;(gimp-image-set-resolution new-image 180 180) ; Canon Printer 600, Epson 720 dpi | |
;(gimp-message "No Anchor Points wanted") | |
; ) | |
;) | |
;(cond | |
; (( equal? anchor-left TRUE ) | |
;(gimp-image-set-resolution new-image 150 150) ; Canon Printer 600, Epson 720 dpi | |
;(gimp-message "Do sumthin ...") | |
; (gimp-ellipse-select new-image 5 5 5 5 REPLACE 1 0 0) | |
; (gimp-context-set-foreground '(255 0 0)); | |
; (gimp-edit-stroke grid-layer) | |
;(gimp-rect-select new-image 0 5 5 1 REPLACE 0 0) ; Create a Cross | |
;(gimp-rect-select new-image 5 0 1 5 0 0 0) | |
;(gimp-context-set-foreground '(0 0 0)); | |
;(gimp-edit-stroke grid-layer) | |
; (gimp-context-set-foreground '(0 255 0)); | |
; (gimp-edit-stroke new-layer) | |
; ) | |
;) | |
;(cond | |
; (( equal? anchor-right TRUE ) | |
;(gimp-image-set-resolution new-image 150 150) ; Canon Printer 600, Epson 720 dpi | |
; (gimp-context-set-foreground '(255 0 0)); | |
; (gimp-ellipse-select new-image (- width 10) 5 5 5 REPLACE 1 0 0) | |
; (gimp-edit-stroke grid-layer) | |
; (gimp-context-set-foreground '(0 255 0)); | |
; (gimp-edit-stroke new-layer) | |
; ) | |
;) | |
; --- No Selection | |
(gimp-selection-none new-image) | |
(gimp-selection-none image) | |
; -- Set Default Colors | |
(gimp-context-set-default-colors) | |
; --- Flush Displays | |
(gimp-displays-flush) | |
(cond | |
( | |
(equal? want-grid TRUE) | |
(gimp-drawable-set-visible grid-layer FALSE) | |
(gimp-drawable-set-visible grid-layer TRUE) | |
) | |
) | |
; --- Set Resolution to selected DPI Setting; place up | |
(gimp-image-set-resolution new-image dpi-value dpi-value) ; Canon Printer 600, Epson 720 dpi | |
; --- cleanup | |
(gimp-image-undo-group-end new-image) | |
(gimp-image-undo-group-end image) | |
) | |
) | |
(script-fu-register "script-fu-cologram" | |
"Create Barrier 3D Photos..." | |
"Interlace all Layers into a Cologram. This is a Free Plugin. 2011 Friedemann Wolpert" | |
"Friedemann" | |
"2011, Friedemann" | |
"6nd August 2011" | |
"*" | |
SF-IMAGE _"The Image" 0 | |
SF-DRAWABLE _"The Layer" 0 | |
SF-ADJUSTMENT _"Rows per Section" '(1 1 100 1 10 0 0) | |
SF-OPTION "Printer Resolution" '("300 DPI Canon" "150 DPI Canon" "180 DPI Epson" "300 DPI Canon" "360 DPI Epson" "600 DPI Canon" "720 DPI Epson") | |
SF-OPTION "Resize Target Image" '("No Changes (Default)" "US-Letter" "US-Legal" "Din A3" "Din A4" "Din A5" "Din A6" "Din A7" "Din A8") | |
SF-TOGGLE "Sharpen Source Images (Improves Quality when Changing Target Size)" FALSE | |
SF-TOGGLE "Create a Parallax Grid Layer (Important)" TRUE | |
; Resize Image when Frames are desired | |
SF-TOGGLE "Create Adjustment Frame" TRUE | |
SF-COLOR "Frame Fore Color" '(0 0 0) | |
SF-COLOR "Frame Rear Color" '(0 0 0) | |
SF-ADJUSTMENT "Adjustment Frame Distance (px)" '(50 0 1000 1 10 0 0) ; Resize Image ! | |
SF-ADJUSTMENT "Adjustment Frame Width (px)" '(1 1 20 1 10 0 0) ; Passerrahmen | |
SF-TOGGLE "Create a Cut Mark" TRUE | |
SF-ADJUSTMENT "Cut Frame Distance from adj. Frame (px)" '(50 0 1000 1 10 0 0) ; Resize Image ! | |
SF-ADJUSTMENT "Cut Frame Width (px)" '(2 1 20 1 10 0 0) ; Schnittmarke | |
;SF-TOGGLE "Print Top Register Mark" FALSE ; Passerkreuz | |
;SF-TOGGLE "Print Down Register Mark" FALSE | |
;SF-TOGGLE "Print Left Register Mark" FALSE | |
;SF-TOGGLE "Print Right Register Mark" FALSE | |
;SF-OPTION "Resize Image for Register Mark" '("Default" "Din-A5" "Din-A4" "Din-A3" ) | |
) | |
(script-fu-menu-register "script-fu-cologram" "<Image>/3D Parallax Barrier") | |
; Friedemann Wolpert 2011, Heise Mach Flott den Schrott 2 Project Entry |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment