Gimp-Forum.net
Simple overwrite image script - Printable Version

+- Gimp-Forum.net (https://www.gimp-forum.net)
+-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP)
+--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP)
+--- Thread: Simple overwrite image script (/Thread-Simple-overwrite-image-script)



Simple overwrite image script - Gravitus - 09-19-2017

Hello.

I need to make some changes with script-fu in picture and then just overwrite edited picture onto source picture. How it is done? (with quality and other settings included)

Now I am using this script, but it just creates new file but does not overwrite source.

Also I will need to use this script with batch, so single solutions will not work here.


RE: Simple overwrite image script - Kevin - 09-19-2017

Can you please point us to a source for this script because we will just be guessing otherwise.


RE: Simple overwrite image script - Gravitus - 09-20-2017

I am using script below, but it is just for saving, so it does not make sense. What I need is script which not saves new image, but just overwrites photo.

Code:
(define (pirmas-crop image layer)

(gimp-crop image 500 300 0 0)
(file-jpeg-save 1 image layer "text.jpg" "text.jpg" 0.93 0 0 1 "" 2 0 0 0)
)
(script-fu-register
"pirmas-crop"
"<Image>/Edgaro/Pirmas Crop"
"Testinis variantas"
"Edgaras"
"Edgaras"
"Rugsėjo 19 d. 2017"
"RGB*, GRAY*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Layer" 0
)



RE: Simple overwrite image script - Kevin - 09-20-2017

OK, you need to replace "text.jpg" with the file name of the image, using gimp-image-get-filename

For example:
Code:
(define (pirmas-crop image layer)
  (let* (
          (filename (car (gimp-image-get-filename image)))
        )
    (gimp-crop image 500 300 0 0)
    (file-jpeg-save 1 image layer filename filename 0.93 0 0 1 "" 2 0 0 0)
  )
)

(script-fu-register
  "pirmas-crop"
  "<Image>/Edgaro/Pirmas Crop"
  "Testinis variantas"
  "Edgaras"
  "Edgaras"
  "Rugsejo 19 d. 2017"
  "RGB*, GRAY*"
  SF-IMAGE "Image" 0
  SF-DRAWABLE "Layer" 0
)



RE: Simple overwrite image script - Gravitus - 09-21-2017

Worked like magic. Thank You.

(09-20-2017, 01:06 PM)Kevin Wrote: OK, you need to replace "text.jpg" with the file name of the image, using gimp-image-get-filename

For example:
Code:
(define (pirmas-crop image layer)
 (let* (
         (filename (car (gimp-image-get-filename image)))
       )
   (gimp-crop image 500 300 0 0)
   (file-jpeg-save 1 image layer filename filename 0.93 0 0 1 "" 2 0 0 0)
 )
)

(script-fu-register
 "pirmas-crop"
 "<Image>/Edgaro/Pirmas Crop"
 "Testinis variantas"
 "Edgaras"
 "Edgaras"
 "Rugsejo 19 d. 2017"
 "RGB*, GRAY*"
 SF-IMAGE "Image" 0
 SF-DRAWABLE "Layer" 0
)