script fu-Copia il visibile e incollalo come ti pare-

Domandate qui se non riuscite ad installare i filtri o gli script, oppure se avete problemi legati alla creazione e modifica dei filtri. Qui si pongono le domande più tecniche.
Rispondi
PhotoComix
Mastro Gimper
Mastro Gimper
Messaggi:1001
Iscritto il:sab 4 mar 2006, 1:20
Contatta:
script fu-Copia il visibile e incollalo come ti pare-

Messaggio da PhotoComix » ven 14 mar 2008, 21:09

Il mio primo script..piu esattamente un assemblaggio di scripts di cui 1 solo mio

E' quasi pronto ,ma quello che c'è giia funziona

se lo provate,critiche commenti e suggerimenti sono benvenuti..

Come suggerisce il nome copia il visibile e permette di farne quello che volete..un nuovo layer ,una nuova immagine, un nuovo pennello

lo script crea questo submenu in EDIT

[img]http://www.imageox.com/image/199483-v2.jpeg[/img]

le opzioni gia disponibili sono

1 copia il visibile su un nuovo layer

2 copia la selezione del visibile su un nuovo layer
( ="applica all'immagine in photoshop)
ma in piu
3 copia il visibile come nuova immagine
4 trasferisce il visibile su un nuovo pennello che diventa il pennello attivo

tutto questo lo fa gia senza bisogno di dialogo ,clicchi sul menu di gimp e ottieni un nuovo layer, una nuova immagine o un nuovo pennello.

tecnicamente è una collezione di 4 script integrati nello stesso submenu, di questi script 3 sono di Fenceposte e 1mio ...ma realizzato con il suo aiuto e sulla base di un suo script simile

Se volete provarlo
PRIMA RIMUOVETE QUALSIASI SCRIPT SIMILE, (= script che iniziano con
"copy visible and paste") nell'ipotetico caso ne abbiate installato uno

ok eccolo

Codice: Seleziona tutto

; This program is free software; you can redistribute it and/or modify

; it under the terms of the GNU General Public License as published by

; the Free Software Foundation; either version 2 of the License, or

; (at your option) any later version.

; 

; This program is distributed in the hope that it will be useful,

; but WITHOUT ANY WARRANTY; without even the implied warranty of

; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

; GNU General Public License for more details.

;

; You should have received a copy of the GNU General Public License

; along with this program; if not, write to the Free Software

; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

;

;

; This script copies the visible layers contained within the active

; image and pastes the results into a single layer at the top of the stack

; of the active image  It is an updated version of Karl Ward's merge-copy script

; which can be found here: http://kward1979uk.deviantart.com/art/Merge-copy-28607825

;

; The Script can be found in the Image's Edit Menu under the name: "Copy Visible & Paste"

;

; Special thanks to saulgoode at gimptalk.com for his suggestions on improving the script.





; Define the Function



(define 

     (copy-visible-paste

     inImage

     inDraw)



; Declare the Variables



     (let*



          (

               (theHeight (car (gimp-image-height inImage))) ; returns the image height.

               (theWidth (car (gimp-image-width inImage))) ; returns the image width.

               (theFloatingSelection) ; an undefined variable to be defined below.

               (theType (car (gimp-drawable-type-with-alpha inDraw))) ; returns the drawables' type with an Alpha Channel

               (theSelection) ; undefined variable to contain the selected area in the image.

               (theResult) ; undefined variable created below to hold the contents of the Copied Layers

          )



; Begin Undo Group



(gimp-undo-push-group-start inImage)



; Get the selected area in the image and save it to a channel



(set! theSelection (car (gimp-selection-save inImage)))



; Clear the selection



(gimp-selection-none inImage)



; Copies the visible layers in the active image



(gimp-edit-copy-visible inImage) 



; Creates a new layer which will ultimately contain the Copied Layers and gives it the name "Copied Layers".



(set! theResult (car (gimp-layer-new inImage theWidth theHeight theType "Copied Layers" 100 NORMAL-MODE)))



; Fills theResult Layer (aka Copied Layers) with transparent fill



(gimp-drawable-fill theResult TRANSPARENT-FILL) 



; Adds theResult Layer to the active image



(gimp-image-add-layer inImage theResult 0) 



; Defines theFloatingSelection variable as containing the pasted layers and keeping the selection active



(set! theFloatingSelection (car (gimp-edit-paste theResult FALSE)))      



; Anchors theFloatingSelection to theResult



(gimp-floating-sel-anchor theFloatingSelection) 



; Reload the original selection (theSelection)



(gimp-selection-load theSelection)



; Delete the channel holding the original selection (theSelection)



(gimp-image-remove-channel inImage theSelection)



; End Undo Group



(gimp-undo-push-group-end inImage)



)



; Update display



(gimp-displays-flush)



)

(script-fu-register      "copy-visible-paste"

               "<Image>/Edit/Copy/Copy Visible&Paste../ as Layer"

               "Copies the visable layers to a new layer and pastes them in into active image"

               "Art Wade"

               "Art Wade"

               "December 2007"

               ""

               SF-IMAGE      "SF-IMAGE" 0

               SF-DRAWABLE   "SF-DRAWABLE" 0

               

)

                    





; Define the Function



(define 

     (copy-visible-paste-select

     inImage

     inDraw)



; Declare the Variables



     (let*



          (

               (theHeight (car (gimp-image-height inImage))) ; returns the image height.

               (theWidth (car (gimp-image-width inImage))) ; returns the image width.

               (theFloatingSelection) ; an undefined variable to be defined below.

               (theType (car (gimp-drawable-type-with-alpha inDraw)))      ; returns the drawables' type with an Alpha Channel

               (theResult (car (gimp-layer-new inImage theWidth theHeight theType "Copied Layers" 100 NORMAL-MODE)))

               ;creates a new layer which will ultimately contain the Copied Layers and gives it the name "Copied Layers".

          )



; Begin Undo Group



(gimp-undo-push-group-start inImage)



; Copies the visible layers in the active image

(gimp-edit-copy-visible inImage) 



; Fills theResult Layer (aka Copied Layers) with transparent fill



(gimp-drawable-fill theResult TRANSPARENT-FILL) 



; adds theResult Layer to the active image



(gimp-image-add-layer inImage theResult 0) 



; defines theFloatingSelection variable as containing the pasted layers and keeping the selection active



(set! theFloatingSelection (car (gimp-edit-paste theResult FALSE)))      



; Anchors theFloatingSelection to theResult



(gimp-floating-sel-anchor theFloatingSelection) 



; End Undo Group



(gimp-undo-push-group-end inImage)



)

)

(script-fu-register      "copy-visible-paste-select"

               "<Image>/Edit/Copy/Copy Visible&Paste../ as selected to new Layer"

               "copies the visable layers to a new layer and pastes them in into active image"

               "Art Wade"

               "Art Wade"

               "December 2007"

               "*"

               SF-IMAGE      "SF-IMAGE" 0

               SF-DRAWABLE   "SF-DRAWABLE" 0

               

)

                    





; Define the Function











    ( define

     (copy-visible-paste-as-new-image

     InImage

     drawable)







; Declare the Variables







     







   (let*



          (

               (OutPutOfVisible)

               



          )



               



          















; Copies the visible layers in the active image on a buffer



(gimp-edit-named-copy-visible InImage "ImgVisible")







; Paste as new image







(set! OutPutOfVisible ( car (gimp-edit-named-paste-as-new "ImgVisible")))







;display the new imagine







(gimp-display-new OutPutOfVisible)





; empty the buffer



( gimp-buffer-delete "ImgVisible")









   

)



)



(script-fu-register      "copy-visible-paste-as-new-image"



               "<Image>/Edit/Copy/Copy Visible&Paste../ as new Image"



               "copies the visible layers to a new image"



               "PhotoComix"



               "photocomix@gmail.com"



               "11 March 2008"



               "*"

                  SF-IMAGE "image" 0  

                

                  SF-DRAWABLE "drawable" 0

)



; Define the Function



(define 

     (copy-visible-paste-as-brush

     inImage

     inDraw

     name

     filename

     spacing)



; Declare the Variables



     (let*



          (

               (theType 0)

               (theSelection)

               (brush-image)

               (brush-draw 0)

               (path 0)

          )





; Copies the visible layers in the active image

(gimp-edit-copy-visible inImage) 



(set! brush-image (car (gimp-edit-paste-as-new)))



(if (= TRUE (car (gimp-image-is-valid brush-image)))

      (begin

        (set! brush-draw (car (gimp-image-get-active-drawable brush-image)))

        (set! theType (car (gimp-drawable-type brush-draw)))

        (set! path (string-append gimp-directory

                                  "/brushes/"

                                  filename

                                  (number->string brush-image)

                                  ".gbr"))

       

        (if (= theType GRAYA-IMAGE)

            (begin

                (gimp-context-push)

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

                (set! brush-draw (car (gimp-image-flatten brush-image)))

                (gimp-context-pop)

            )

        )

       

        (file-gbr-save RUN-NONINTERACTIVE

                       brush-image brush-draw path path

                       spacing name)

       

        (gimp-image-delete brush-image)

       

        (gimp-brushes-refresh)

        (gimp-context-set-brush name)

      )

     )

  )

)





(script-fu-register      "copy-visible-paste-as-brush"

               "<Image>/Edit/Copy/Copy Visible&Paste../as Active Brush"

               "Copies the visible layers to a new image and pastes them as a brush"

               "Art Wade"

               "Art Wade"

               "January 2008"

               "*"

               SF-IMAGE      "SF-IMAGE" 0

               SF-DRAWABLE   "SF-DRAWABLE" 0

               SF-STRING     _"Brush name" "My Brush"

               SF-STRING     _"File name"  "mybrush"

               SF-ADJUSTMENT _"Spacing"    '(25 0 1000 1 1 1 0)

               

)
La funzione che ancora devo aggiungere è
"copia il visibile e salvalo come vuoi"
che dovrebbe offrire queste opzioni
1 o piu possono essere scelte (volendo pure tutte)

1 salva come pennello
(il vantaggio qui su "copia e incolla come pennello attivo è che riinizilizzare i pennelli è una cosa lunga, necessaria a usare un pennello nuovo ,ma non per salvarlo)
2salva come pattern
3salva per il web(= .jpg)
4 salva come render (=.png)
5 salva per editare (=xcf)


ma quest'ultima parte è ancora in cottura... :D

Avatar utente
zavv
Apprendista
Apprendista
Messaggi:22
Iscritto il:ven 29 giu 2007, 17:13
Località:Catanzaro

Messaggio da zavv » sab 15 mar 2008, 3:04

Funziona con qualsiasi versione di gimp?
Perchè io ho la 2.2 e mi da errore quando provo a copiare l'immagine come una nuova (scusate la ripetizione) immagine o come nuovo pennello attivo.
Immagine

PhotoComix
Mastro Gimper
Mastro Gimper
Messaggi:1001
Iscritto il:sab 4 mar 2006, 1:20
Contatta:

Messaggio da PhotoComix » sab 15 mar 2008, 7:16

No serve gimp 2.4

potrebbe essere adattato credo ma ...gimp 2.2 ormai è una vecchia versione
e adattarlo è noioso,anche perchè credo alcune funzioni usate non esistevano su gimp 2.2

Avatar utente
zavv
Apprendista
Apprendista
Messaggi:22
Iscritto il:ven 29 giu 2007, 17:13
Località:Catanzaro

Messaggio da zavv » sab 15 mar 2008, 15:08

OK. Grazie. :wink:
Immagine

Avatar utente
Lazza
Amministratore
Amministratore
Messaggi:5254
Iscritto il:dom 5 set 2004, 13:06
Località:Italia
Contatta:

Messaggio da Lazza » dom 16 mar 2008, 19:40

Usa un pastebin accidenti!

PhotoComix
Mastro Gimper
Mastro Gimper
Messaggi:1001
Iscritto il:sab 4 mar 2006, 1:20
Contatta:

Messaggio da PhotoComix » mar 18 mar 2008, 18:38

cos'è un pastebin?
certo mi aspettavo che "code" mettesse tutto in una finestrella scorrevole invece aggiunge solo un buffo effetto stile verde e nero tipo DOS e sparare tutto grande

Sto finendolo lo script appena pronto sostituisco tutto con un bel link

Per ora voglio evitare confusioni e quindi upload di diverse versioni ,magari incompatibili fra loro dello stesso script

Voglio dire trovandolo qui è piu chiaro che è un wip..spero

comunque funziona benissimo anche cosi ..e che se poi lo completo le 2 versioni se installate tutte e due potrebbero diventare incompatibili fra loro

Avatar utente
Lazza
Amministratore
Amministratore
Messaggi:5254
Iscritto il:dom 5 set 2004, 13:06
Località:Italia
Contatta:

Messaggio da Lazza » mar 18 mar 2008, 19:08

Un pastebin è un sito dove fare copia e incolla... Questo topic è impresentabile (considerando le innumerevoli righe vuote o di commento che potevi eliminare con strumenti tipo sed o awk, o le semplici espressioni regolari :wink: ), per cui mi vedrò costretto a tagliarlo se rimarrà così... Capisci vero?

Rispondi