(define (web-image-frame filename frameradius blurradius) ( let* ( ;open the image (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) ;get the original layer (original-image (car (gimp-image-get-active-layer image))) ;create two copies of this layer (frame (car (gimp-layer-new-from-drawable original-image image))) (blur (car (gimp-layer-new-from-drawable original-image image))) (background (car (gimp-layer-new-from-drawable original-image image))) (w (car (gimp-image-width image))) (h (car (gimp-image-height image))) ) ;insert the two newly created layers (gimp-image-add-layer image frame 1) (gimp-image-add-layer image blur 2) (gimp-image-add-layer image background 3) ;grow the image by 2*(blurradius+frameradius) (gimp-image-resize image (+ w ( * 2 ( + blurradius frameradius))) (+ h ( * 2 ( + blurradius frameradius))) ( + blurradius frameradius) ( + blurradius frameradius)) ;resize the frame and blur layers (gimp-layer-resize frame (+ w ( * 2 frameradius)) (+ h ( * 2 frameradius)) frameradius frameradius) (gimp-layer-resize blur (+ w ( * 2 frameradius)) (+ h ( * 2 frameradius)) frameradius frameradius) ;fill the frame and blur layers in black(gimp-context-set-foreground ) (gimp-drawable-fill frame FOREGROUND-FILL) (gimp-drawable-fill blur FOREGROUND-FILL) ;resize the blur layer to the size of the image (gimp-layer-resize-to-image-size blur) ;blur it (plug-in-gauss-rle RUN-NONINTERACTIVE image blur blurradius 1 1) ;resize the background layer to the size of the image (gimp-layer-resize-to-image-size background) ;flatten ( let* ( (flattened-layer (car (gimp-image-flatten image)))) (gimp-file-save RUN-NONINTERACTIVE image flattened-layer filename filename) ) (gimp-image-delete image) ) )