It is currently Tue Jul 14, 2026 8:08 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Histogram RGB set-foreground
PostPosted: Wed Apr 26, 2017 8:43 am  (#1) 
Offline
New Member

Joined: Apr 26, 2017
Posts: 2
Hey guys!
Im not very good at coding and I know little about scm. Any help would be really appreciated...

Trying to find the dominate color in a image and return it to "foreground box".
I got the RGB values but not sure how to link it up to the box.

(define (Sticker-1 image layer)

  (let* (
          (histo_RED (gimp-histogram layer HISTOGRAM-RED 0 255))
          (R_value (number->string (car (cdr (cdr histo_RED)))))
       
          (histo_GREEN (gimp-histogram layer HISTOGRAM-GREEN 0 255))
          (G_value (number->string (car (cdr (cdr histo_GREEN)))))
 
          (histo_BLUE (gimp-histogram layer HISTOGRAM-BLUE 0 255))
          (B_value (number->string (car (cdr (cdr histo_BLUE )))))
      
)

;        (gimp-message-set-handler ERROR-CONSOLE)
;        (gimp-message (string-append R_value " " G_value " " B_value))
;        (gimp-displays-flush)
   

       (gimp-context-set-foreground (list R_value G_value B_value))
       (gimp-edit-fill layer FOREGROUND-FILL)
       (gimp-displays-flush)
   
         
      

)
)
(script-fu-register "Sticker-1"
     _"Sticker _1..."
    "Add outlines to image via avg COLOR."
    "CB"
    "NN"
    "April 2017"
     ""
     SF-IMAGE "Input Image" 0
     SF-DRAWABLE "Input Drawable" 0

   
)   
(script-fu-menu-register "Sticker-1"  "<Image>/Filters/Edge-Detect")


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Histogram RGB set-foreground
PostPosted: Wed Apr 26, 2017 9:21 am  (#2) 
Offline
Script Coder
User avatar

Joined: Jun 22, 2010
Posts: 1171
Location: Here and there
You're trying to set the foreground colour using a list of three STRING values.

Don't do the number->string conversion.
(R_value (car (cdr (cdr histo_RED)))) etc


Top
 Post subject: Re: Histogram RGB set-foreground
PostPosted: Wed Apr 26, 2017 9:26 am  (#3) 
Offline
New Member

Joined: Apr 26, 2017
Posts: 2
paynekj wrote:
You're trying to set the foreground colour using a list of three STRING values.

Don't do the number->string conversion.
(R_value (car (cdr (cdr histo_RED)))) etc



Thanks a lot for the help!
Well appreciated -


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group