5 hours ago
(This post was last modified: 5 hours ago by rgbellotti.)
I found this work-around to work alright so far, and figured I'd post here in case anyone else ever came across that scenario. This test function will essentially place one pixel on a new image of the color you specify:
Code:
(define (test-set-pixel)
(let* (
;; Create a new image and drawable
(frame (car (gimp-image-new 10 10 RGB)))
(drawframe (car (gimp-layer-new frame 10 10 1 "Test Layer" 100 28)))
)
;; Add the new layer to the image
(gimp-image-insert-layer frame drawframe 0 -1)
;; Set the foreground color to red (the brush color that you will draw)
(gimp-context-set-foreground '(255 0 0))
;; Set the brush size and settings to pixel-perfect accuracy
(gimp-context-set-brush-size 1)
(gimp-context-set-brush-angle 0)
(gimp-context-set-brush-aspect-ratio 0)
(gimp-context-set-brush-hardness 1)
(gimp-context-set-brush-force 1)
;; Use the pencil tool to draw a single pixel
;; NOTE ;; "PRESS" and "RELEASE" are both considered a "stroke" of the pencil
;; so use '2' for the stroke count, for PRESS = (5,5) RELEASE = (5,5)
(gimp-pencil drawframe 2 #(5 5 5 5))
;; Save the image
(file-png-save 1 frame drawframe "test_pixel.png" "test_pixel.png" 1 9 1 1 1 1 1)
(gimp-message "Test image saved.")
(gimp-image-delete frame)
)
)