Gimptalk - Premier Gimp Community: (SOLVED) Save jpeg with current image settings - Gimptalk - Premier Gimp Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

(SOLVED) Save jpeg with current image settings

#1 User is offline   SamKook 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 26-July 10

Posted 26 July 2010 - 02:42 AM

I made a script to crop a dvd cover jpeg image and I was wondering if it was possible to use the current quality settings to save the cropped image.

Here's my current script:
(define (crop-crpd code)
(let* (
(company (substring code 0 4))
(input (string-append "./" code "/" code ".jpg"))
(output (string-append "./" code "/folder.jpg"))
(image (car (file-jpeg-load 1 input output)))
(drawable)
)
(gimp-image-crop image 379 536 421 0)
;Example si on veut setter une variable en dehors de la declaration(it wasn't necessary in this case)
(set! drawable (car (gimp-image-get-active-drawable image)))
;save en jpeg, qualite 90%
(file-jpeg-save 1 image drawable output output 0.9 0 1 0 "" 0 1 0 0)))

;Set the file(s) to be cropped
(crop-crpd "CRPD-036")

(gimp-quit 0)


Instead of saving to a fixed 0.9 quality setting, I would like to use the quality of the loaded jpeg.

Also, I execute the script from a .bat and I was wondering if there is a way to not have to press a key after execution? I would like the cmd window to simply disappear.

Command from .bat:
gimp-2.6 -i -b - < crop-crpd.txt

0

#2 User is offline   SamKook 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 5
  • Joined: 26-July 10

Posted 27 July 2010 - 02:19 AM

I finally found the answer with the help of the people from the gimp channel on irc:
(/ (char->integer (string-ref (caddr (car (gimp-image-parasite-find image "jpeg-settings"))) 1)) 100.0)

This will get the quality value from the parasite "jpeg-settings" of the loaded image, convert it from ascii to integer(ex: Z to 90) and then to float.

Nom all I need to know is if it's possible to not have to press a key to close the cmd windows of gimp after the execution of the script from a .bat.

Edit: Found that too, I only needed to use gimp-console instead of gimp.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic