Gimp-Forum.net
Batch convert Jpeg into monochrome pcx - 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)
+---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions)
+---- Thread: Batch convert Jpeg into monochrome pcx (/Thread-Batch-convert-Jpeg-into-monochrome-pcx)



Batch convert Jpeg into monochrome pcx - BubbleFritten - 08-11-2021

Hello,

i want to convert some jpeg's to monochrome pcx. To solve the problems step by step  my first try is to convert to monochrome jpg, but this didn't work.
The saved picture is still colorized. Even if i try the greyscale command it's colorized.
What's wrong with the script?


Code:
(define (convert-mono pattern )
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(gimp-image-convert-indexed image CONVERT-DITHER-NONE CONVERT-PALETTE-MONO 0 0 1 "" )
(drawable (car (gimp-image-get-active-layer image))))
(gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
(gimp-image-delete image))
(set! filelist (cdr filelist)))))
EDIT
for testing purposes i have made the following version, it didn't work.
The result is not grayscaled.

Code:
(define (convert-mono pattern )
(let* ((filelist (cadr (file-glob pattern 1))))
 (while (not (null? filelist))
 (let* (
       (filename (car filelist))
       (destination_file "")
       (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
     (drawable (car (gimp-image-flatten image)))
     (gimp-image-convert-grayscale image)
       )
       
  (set! destination_file (string-append "out-" filename))
  (gimp-file-save RUN-NONINTERACTIVE image drawable destination_file destination_file)
  (gimp-image-delete image)
 )
 
 (set! filelist (cdr filelist)))
)
)



RE: Batch convert Jpeg into monochrome pcx - rich2005 - 08-12-2021

I can not give you an answer, not a coding person, so I will bump this up and hope one of the clever guys sees it.