Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 5,093
» Latest member: DaneJoson
» Forum threads: 7,113
» Forum posts: 38,894
Full Statistics
|
|
|
Problems file-png-save-defaults |
Posted by: Petequero - 05-18-2018, 11:33 PM - Forum: Extending the GIMP
- Replies (1)
|
|
Hello guys,
I am new here, and I wrote my first script-fu.
Unfortunately, it does not work (yet )
My script is about resizing png images, and then save them.
The script seems to be working for the resizing.
However, I don't manage to save the new pics.
I am working on windows 10 with GIMP 2.10.
My code is below.
Any feedback would be appraciated
Code:
(script-fu-register
"script-fu-resize-theimages" ;Nom de la fonction (console)
"Redim" ;Nom du sous menu dans l'onglet /File/Create/Redimensionnement Image
"Redimensionne tes images png de la taille\
que tu veux, et avec l'interpolation\
que tu veux. Trop cool isn't it ?" ;description
"Dav The Crouch, allias la classique" ;author
"copyright the GIMP Documentation Team" ;copyright notice
"Pour entrer dans l'histoire : Mai 18, 2018" ;date created
"" ;image type that the script works on
SF-DIRNAME "Chemin source" ""
SF-ENUM "Interpolation" '("InterpolationType" "linear") ; Menu déroulant avec une interpolation à choisir
SF-VALUE "Width" "30" ; Menu à trou : Entré de la largeur finale de l'image
SF-VALUE "Height" "30" ; Menu à trou : Entré de la largeur finale de l'image
SF-DIRNAME "Chemin cible" ""
)
(script-fu-menu-register "script-fu-resize-theimages" "<Image>/File/Create/Redimentionnement Image") ; create a menu
(define (script-fu-resize-theimages sourcepath inInterpol inWidth inHeight destinationPath); On défini une fonction d'entrée qui prend les 3 paramètres du menu défini plus haut
(let*
(
; sélectionner le dossier à traiter avec SF-DIRNAME
; on chope tout les noms de chemin et les noms des images et on en fait une liste. Exemple :
; C:/Users\\ADOM.png" "C:/Users\\ADOM_grisée.png" ect...
(filelist (cadr (file-glob (string-append sourcepath "\\*.png") 1)))
)
; On prend donc les noms de la liste un par un, tant qu'il y en a
(while (not (null? filelist)) ;2 fonctions, une qui resize et sauvegarde, l'autre qui met à jour la liste-compteur (filelist)
(let*
(
; on prend le premier chemin associer à la première image
(first-filename (car filelist))
; On définit la variable image (pour les fonctions)
(image (car (gimp-file-load RUN-NONINTERACTIVE first-filename first-filename)))
; On définit de la variable drawable
(drawable (car (gimp-image-get-active-drawable image)))
; On reconstruit le nom : chemin/image.png
(outputfilename
(string-append ;On concatene :
(string-append destinationPath "/") ;chemin/
(cadr (strbreakup first-filename "\\")) ;image.png
)
)
)
; On défini l'interpolation
(gimp-context-set-interpolation inInterpol)
; Et finalement on lance le redimensionnement
(gimp-image-scale image inWidth inHeight)
;sauvegarde de l'image
(file-png-save-defaults RUN-NONINTERACTIVE image drawable outputfilename outputfilename)
;(file-png-save RUN-NONINTERACTIVE image drawable outputfilename outputfilename FALSE 9 TRUE FALSE FALSE TRUE TRUE)
;fermeture de l'image
(gimp-image-delete image)
)
; On supprime les "chemin/image.png" déjà fait
(set! filelist (cdr filelist))
)
)
)
Thank you in advance for any comment.
David
|
|
|
Launcher for gimp |
Posted by: gimp-artist - 05-17-2018, 12:00 PM - Forum: General questions
- Replies (9)
|
|
I have a launcher icon for gimp for my ubuntu system. One day I used script-fu windows in gimp. Then the launcher icon was overlapped together. That's all fine.
After the first use of script-fu windows in gimp, there is no turning back to normal gimp launcher icon. It indicates "script-fu" not gimp itself. So when I click the launcher gimp won't start, of course I restarted my pc.
I registered a new gimp launcher, but it doesn't resolve the issue.
What should I do to fix this unusual issue?
|
|
|
Some scripts not recognized |
Posted by: dhugg - 05-16-2018, 09:06 PM - Forum: Extending the GIMP
- Replies (1)
|
|
hello,
having trouble with certain scripts:
gimp_spinning_cube_script_by_fence_post-d184gze.scm
spinning-cube.scm
added the script ; refreshed scripts and restarted gimp 2.8 ; verified it is there ; doesnt show up in the "filters>animations>" menu or anyplace else;
any ideas what i might be doing wrong, other scripts ok???
thanks dhugg
|
|
|
|