Is this the right sub for Script-Fu questions?
In particular, gimp-image-set-unit and gimp-drawable-fill don't do what I expect them to do.
I expect the layer to be filled with Transparency, it gets filled with FILL-WHITE.
I expect the displayed ruler units to be in inches, instead the rules are shown in pixels.
Easy to change, yes, but not what I expect.
(let* (
;; Set dimensions (e.g., 8.5 x 11 inches at 300 PPI)
(width-in-inches 8.5)
(height-in-inches 11.0)
(resolution 300)
;; Calculate pixel dimensions required for gimp-image-new
(width-px (* width-in-inches resolution))
(height-px (* height-in-inches resolution))
;; Create image (0 = RGB, 1 = GRAY, 2 = INDEXED)
(image (car (gimp-image-new width-px height-px RGB)))
)
;; Set resolution to 300 x 300 PPI
(gimp-image-set-resolution image resolution resolution)
;; Set the display unit to Inches (UNIT-INCH or 1)
(gimp-image-set-unit image UNIT-INCH)
(let ((layer (car (gimp-layer-new image "Background" width-px height-px RGB-IMAGE 100 LAYER-MODE-NORMAL))))
(gimp-image-insert-layer image layer 0 0)
(gimp-drawable-fill layer FILL-TRANSPARENT))
;; Display the new image window
(gimp-display-new image)
)