Wednesday, February 24, 2010

Week 5 Assignment: Script-Fu Color Wheel

;This code creates a color wheel with twelve hues that follow the same scheme as the previous color wheel assignment but is totally automated.



;Creates the image
(define img
(car
(gimp-image-new 512 512 0
)
)
)

;Displays the image
(gimp-display-new img)


;I created a background with a radial gradient for aesthetic purposes.


;Code for the Background
(define layer
(car
(gimp-layer-new img 512 512 0 "Shadow" 100 0
)
)
)

(gimp-image-add-layer img layer -1)

(gimp-context-set-background '(0 0 0))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 550 0)


;For each layer creation I create a layer with a radial gradient from white to the layer color. I then select a wedge to keep and delete the rest of the layer. I then rotate it to it's correct position in the wheel.


;Code for the Red layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Red" 100 0
)
)
)

(gimp-image-add-layer img layer -1)

(gimp-context-set-background '(255 0 0))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(255 0 0))

(gimp-selection-none img)



;Code for the Orange layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Orange" 100 0
)
)
)

(gimp-image-add-layer img layer -2)

(gimp-context-set-background '(255 102 0))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(255 102 0))

(gimp-selection-none img)

(gimp-rotate layer TRUE 0.523598776)



;Code for the Yellow layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Yellow" 100 0
)
)
)

(gimp-image-add-layer img layer -3)

(gimp-context-set-background '(255 255 0))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(255 255 0))

(gimp-selection-none img)

(gimp-rotate layer TRUE 1.04719755)



;Code for the Chartreuse layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Chartreuse" 100 0
)
)
)

(gimp-image-add-layer img layer -4)

(gimp-context-set-background '(127 255 0))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(127 255 0))

(gimp-selection-none img)

(gimp-rotate layer TRUE 1.57079633)



;Code for the Green layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Green" 100 0
)
)
)

(gimp-image-add-layer img layer -5)

(gimp-context-set-background '(0 255 0))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(0 255 0))

(gimp-selection-none img)

(gimp-rotate layer TRUE 2.0943951)



;Code for the Spring Green layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Spring Green" 100 0
)
)
)

(gimp-image-add-layer img layer -6)

(gimp-context-set-background '(0 255 127))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(0 255 127))

(gimp-selection-none img)

(gimp-rotate layer TRUE 2.61799388)



;Code for the Cyan layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Cyan" 100 0
)
)
)

(gimp-image-add-layer img layer -7)

(gimp-context-set-background '(0 255 255))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(0 255 255))

(gimp-selection-none img)

(gimp-rotate layer TRUE 3.14159625)



;Code for the Blue layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Blue" 100 0
)
)
)

(gimp-image-add-layer img layer -8)

(gimp-context-set-background '(0 0 255))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(0 0 255))

(gimp-selection-none img)

(gimp-rotate layer TRUE -2.61799388)



;Code for the Azure layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Azure" 100 0
)
)
)

(gimp-image-add-layer img layer -9)

(gimp-context-set-background '(0 127 255))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(0 127 255))

(gimp-selection-none img)

(gimp-rotate layer TRUE -2.0943951)



;Code for the Violet layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Violet" 100 0
)
)
)

(gimp-image-add-layer img layer -10)

(gimp-context-set-background '(238 130 238))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(238 130 238))

(gimp-selection-none img)

(gimp-rotate layer TRUE -1.57079633)



;Code for the Magenta layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Magenta" 100 0
)
)
)

(gimp-image-add-layer img layer -11)

(gimp-context-set-background '(255 0 255 ))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(255 0 255))

(gimp-selection-none img)

(gimp-rotate layer TRUE -1.04719755)


;Code for the Rose layer creation
(define layer
(car
(gimp-layer-new img 512 512 0 "Rose" 100 0
)
)
)

(gimp-image-add-layer img layer -12)

(gimp-context-set-background '(255 0 127))

(gimp-context-set-foreground '(255 255 255))

(gimp-edit-blend layer 3 0 2 100 0 0 FALSE FALSE 1 0 TRUE 256 256 256 0)

(gimp-free-select img 6 #(181 0 319 0 255 260) 2 TRUE FALSE 0)

(gimp-selection-invert img)

(gimp-edit-clear layer)

(plug-in-colortoalpha 1 img layer '(255 0 127))

(gimp-selection-none img)

(gimp-rotate layer TRUE -0.523598776)





(script-fu-register

"script-fu-ITVColorWheel"

"Color Wheel Grad"

"This script creates a color wheel\
with twelve hues that have a gradient\
which increases in value from the center."

"IsaacTV"
"copyright 2010, ITV"
"2010.2"
"RGB* GRAY*"

)
(script-fu-menu-register "script-fu-ITVColorWheel" "/Image/Filters/ITVColorWheel")

No comments:

Post a Comment