User Tools

Site Tools


informatica:linux:gimp:script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
informatica:linux:gimp:script [2021/09/22 19:32] – [Ejemplo 2 (RISK)] joseinformatica:linux:gimp:script [2021/09/22 20:55] (current) – [Ejemplo 2 (RISK)] jose
Line 104: Line 104:
  
 ====== Ejemplos ====== ====== Ejemplos ======
-====== Ejemplo 1 ======+===== Ejemplo 1 =====
 Desde una selección, amplía, hace borde y rellena con BG Desde una selección, amplía, hace borde y rellena con BG
 <code> <code>
Line 120: Line 120:
 {{:informatica:linux:gimp:kungfu3.png|}} {{:informatica:linux:gimp:kungfu3.png|}}
  
-====== Ejemplo 2 (RISK) ======+===== Ejemplo 2 (RISK) =====
 Creamos el borde en una nueva capa. Lo hace sobre la última imagen. Mejor solo tener una abierta. Creamos el borde en una nueva capa. Lo hace sobre la última imagen. Mejor solo tener una abierta.
 <code> <code>
Line 163: Line 163:
 </code> </code>
  
 +
 +====== Ejecutar Script ======
 +Copiamos este script en el directorio de scripts con la extensión scm. Para saber cual es el directorio de scripts, vamos a:
 +  Edit > Preferences > Folders > Scripts
 +Suele ser:
 +  <HOME>/.config/GIMP/2.10/scripts
 +En este ejemplo, aparece con el nombre **Risk** en el menu de Filters. Una vez copiado, para que aparezca en el menú, pulsamos: **Filters > Script-Fu > Refresh Scripts**
 +
 +<code>
 +( define (script-fu-risk)
 +(let* (
 +        (MyIMAGE (aref (cadr (gimp-image-list)) 0))
 +        (MyLAYER (car (gimp-image-get-active-layer MyIMAGE)))
 +        (MySELECTION1 (car (gimp-selection-save MyIMAGE)))
 +      )
 +  (gimp-selection-grow MyIMAGE 8)
 +  (gimp-selection-border MyIMAGE 8)
 +  (gimp-edit-copy MyLAYER)
 +  (let* (
 +          (MySELECTION2 (car (gimp-selection-save MyIMAGE)))
 +          (MyFLOATING (car (gimp-edit-paste MyLAYER FALSE)))
 +        )
 +    (gimp-floating-sel-to-layer MyFLOATING)
 +    (let (
 +           (MyLAYER2 (car (gimp-image-get-active-layer MyIMAGE)))
 +         )
 +        (gimp-image-select-item MyIMAGE 2 MySELECTION1)
 +        (gimp-drawable-edit-fill MyLAYER2 0)
 +        (gimp-image-select-item MyIMAGE 2 MySELECTION2)
 +        (gimp-drawable-edit-fill MyLAYER2 1)
 +        (gimp-selection-none MyIMAGE)
 +        (gimp-image-remove-channel MyIMAGE MySELECTION1)
 +        (gimp-image-remove-channel MyIMAGE MySELECTION2)
 +        (gimp-displays-flush)
 +    )
 +  )
 +)
 +)
 +
 +  (script-fu-register
 +    "script-fu-risk"                            ;func name
 +    "Risk"                                      ;menu label
 +    "Crea un Layer con el pais seleccionado
 +      de color de FG y el borde mas gordo"      ;description
 +    "Iwanttobefreak"                            ;author
 +    "copyleft 2021"                             ;copyright notice
 +    "Setember 22, 2021"                          ;date created
 +    ""                     ;image type that the script works on
 +)
 +  (script-fu-menu-register "script-fu-risk" "<Image>/Filters")
 +
 +</code>
informatica/linux/gimp/script.1632339129.txt.gz · Last modified: 2021/09/22 19:32 by jose