Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Plug In file-heif-save
#6
I was trying to use this plugin from external command line but could not figure it out. Confused

Luckily I found http://beefchunk.com/documentation/lang/...-script-fu

With this finally I understood how to call this plugin, this is, not directly but via another script. For me it worked creating and registering my own script that used file-heif-save, after that it was just a matter of executing from bash, as shown in the link.

Using the great scripts developed by David M. MacMillan (thanks for sharing under GNU GPL), like dmmConvertPNGtoJPG, I changed bits and pieces so that script used file-heif-save instead of file-jpeg-save. Later it was a matter of placing it in GIMP scripts folder, refreshing GIMP's script-fu scripts, and calling the registered script from bash shell.

convertJPGtoHEIF.scm:
Code:
(define (convertJPGtoHEIF infile outfile)
  (let* ((image (car (file-jpeg-load 1 infile infile)))
         (drawable (car (gimp-image-active-drawable image)))
        )

        (file-heif-save 1 image drawable outfile outfile
             50 0 )
           ; 50 quality (int32 0 <= x <= 100)
           ;      0 use lossless compression (0 = lossy, 1 = lossless)

  )
)

(script-fu-register    
  "convertJPGtoHEIF"                             ; script name to register
  "<Toolbox>/Xtns/Script-Fu/conv/convertJPGtoHEIF" ; where it goes
  "Convert JPG to HEIF"                         ; script description
  "David M. MacMillan, modded by jmarcorb"          ; author
  "Copyright 2004 by David M. MacMillan; GNU GPL"  ; copyright
  "2018-09-08"                                     ; date
  ""                                               ; type of image
  SF-FILENAME "Infile" "infile.png"                ; default parameters
  SF-FILENAME "Outfile" "outfile.png"
)
Register in GIMP and then execute from bash:

Code:
gimp -c -i -d -b "(convertJPGtoHEIF \"image2.jpg\" \"image2.heif\")" "(gimp-quit 0)"

Hope it helps Big Grin .
Reply


Messages In This Thread
Python Plug In file-heif-save - by Julio85 - 09-06-2018, 10:11 AM
RE: Python Plug In file-heif-save - by rich2005 - 09-06-2018, 11:04 AM
RE: Python Plug In file-heif-save - by rich2005 - 09-06-2018, 03:25 PM
RE: Python Plug In file-heif-save - by Julio85 - 09-06-2018, 04:24 PM
RE: Python Plug In file-heif-save - by Ofnuts - 09-06-2018, 09:10 PM
RE: Python Plug In file-heif-save - by jmarcorb - 09-08-2018, 06:19 PM
RE: Python Plug In file-heif-save - by Julio85 - 09-10-2018, 09:06 AM

Forum Jump: