Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
gimp-drawable-set-pixel giving unspecified error
#2
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)
 )
)
Reply


Messages In This Thread
RE: gimp-drawable-set-pixel giving unspecified error - by rgbellotti - 5 hours ago

Forum Jump: