[Gimp-user] Script-Fu: remove Exif, thumbnail, color profile when saving PNG



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
("out.png"):


#!/bin/sh
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
                              CONVERT-DITHER-NONE
                              CONVERT-PALETTE-GENERATE
                              16 FALSE FALSE "")
  (file-png-save2 RUN-NONINTERACTIVE image drawable outfile outfile FALSE 9
                  FALSE FALSE FALSE FALSE FALSE FALSE FALSE))
(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?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]