Re: [Gimp-user] gimp-file-save : how to specify the JPEG quality
- From: Shlomi Fish <shlomif shlomifish org>
- To: Helmut Jarausch via gimp-user-list <gimp-user-list gnome org>
- Subject: Re: [Gimp-user] gimp-file-save : how to specify the JPEG quality
- Date: Wed, 19 Jun 2019 15:41:12 +0300
Hi Helmut,
On Wed, 19 Jun 2019 11:22:25 +0200
Helmut Jarausch via gimp-user-list <gimp-user-list gnome org> wrote:
Hi,
I've found a script for batch "wavelet sharpening" all images in a
folder.
This .scm script uses the function gimp-file-save.
The (sharpened) image has only 6 instead of 10 Mbytes. A JPEG quality
estimator shows
98% for the original file and only 90% for the sharpened file.
When exporting a file to JPEG interactively one can specify the quality.
But how to do this in a non-interactive procedure.
please try using gimp-file-jpeg-save instead - it has a quality parameter. You
can find it in the procedural db.
Here is the full procedure
;
; Version 1.0 07.02.2012 for capnhud
; See http://gimpchat.com/viewtopic.php?f=8&t=3701
; command line
; gimp -i -f -d --verbose -b "(batch_wavelet_sharpen <AMOUNT> <RADIUS>
\".jpg\" \"sharpened\")" -b "(gimp-quit 0)"
(define selffilename "\n- batch_wavelet_sharpen.scm")
; Batch mode wrapper
(define (batch_wavelet_sharpen amount radius file_extension
destination_directory)
(let*
(
(destination_file "")
(varFileList (cadr (file-glob (string-append "*" file_extension)
1))) ; make a list of all the files that match the file extension
; Adjust these values to suit
; (amount 0.3)
; (radius 1.0)
(luminance TRUE)
)
(gimp-message-set-handler ERROR-CONSOLE)
(if (not (file-exists? destination_directory))
(error (string-append "Error: directory " destination_directory
" doesn't exist"))
(if (= (file-type destination_directory) FILE-TYPE-DIR)
()
(error (string-append destination_directory " is not a
directory"))
)
)
; loop through all the files in the list
(for-each
(lambda (filename)
(let* (
(image (car (gimp-file-load RUN-NONINTERACTIVE filename
filename))) ; load the image
(drawable (car (gimp-image-flatten image)))
)
(gimp-message (string-append "processing-" filename))
; Thing to do goes here
(plug-in-wavelet-sharpen RUN-NONINTERACTIVE image
drawable amount radius luminance)
(set! destination_file (string-append
destination_directory DIR-SEPARATOR filename))
(gimp-file-save RUN-NONINTERACTIVE image drawable
destination_file destination_file)
(gimp-image-delete image) ; unload the
image
)
)
varFileList
)
)
)
_______________________________________________
gimp-user-list mailing list
List address: gimp-user-list gnome org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives: https://mail.gnome.org/archives/gimp-user-list
--
-----------------------------------------------------------------
Shlomi Fish http://www.shlomifish.org/
https://github.com/shlomif/what-you-should-know-about-automated-testing
When people agree with me I always feel I must be wrong.
— https://en.wikiquote.org/wiki/Oscar_Wilde (via fortune-mod)
Please reply to list if it's a mailing list post - http://shlom.in/reply .
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]