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
)