Why do you use Gimp for this... You script would run faster using
ImageMagick (for the conversion) and ExifTool (to remove the Exif data):

convert in.png PNG8:out.png
exiftool all= out.png

On 24/08/2022 15:52, Sam Lee via gimp-user-list wrote:
Hello, I have written a Script-Fu batch program that is intended to
reduce the file size of a PNG image ("in.png") by converting it into
"indexed" mode with a color palette of 16 colors, and saving the output

gimp-console --batch '
(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "in.png" "in.png")))
        (drawable (car (gimp-image-flatten image)))
        (outfile "out.png"))
   (gimp-image-convert-indexed image
                               16 FALSE FALSE "")
   (file-png-save2 RUN-NONINTERACTIVE image drawable outfile outfile FALSE 9
(gimp-quit 0)'

This script works. However, it always includes Exif data, thumbnail, and
the color profile when I save the PNG, which I do not want because they
make the saved image larger. I know that if I change `(file-png-save2
RUN-NONINTERACTIVE ...)` to `(file-png-save2 RUN-INTERACTIVE ...)`, a
dialog will pop up where I can uncheck the "Save Exif data", "Save
thumbnail", and "Save color profile" checkboxes. I want to disable the
"Save Exif data", "Save thumbnail", and "Save color profile" in a
non-interactive way (i.e. without requiring the interactive dialog box)
when saving a PNG. How can I do that?
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

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

Reply via email to