Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Gimp 2.10 'with files' batch
#1
As you know, I am not a coder. 
Selina in this post https://www.gimp-forum.net/Thread-Changi...5#pid11445 has an unknown number of .xcf files of various ppi and would like all as 96 ppi.

A little plugin to do one at a time: Does not do much, sets the ppi and saves the image straight away.

Code:
#!/usr/bin/python
# -*- coding: utf-8 -*-

from gimpfu import*

def plugin_96ppi(img, drawable):
    
    filename = img.filename
    pdb.gimp_image_set_resolution(img, 96.0, 96.0)
    pdb.gimp_file_save(img, drawable, filename, filename)    
    pdb.gimp_image_clean_all(img)

register(
        "python_fu_96ppi",
        "set96ppi",
        "*",
        "*",
        "*",
        "2018",
        "<Image>/Tools/set-96ppi",
        "*",
        [],
        [],
        plugin_96ppi)

main()

Can this be used in a Gimp batch mode? https://wiki.gimp.org/wiki/Release:2.10_changelog has a with-files macro. Seems simple but I can not get this to work. Not using the flatpak, using a 'bunt' 18.10 VM & Gimp 2.10.6

Quote:-A new 'with-files' macro is available to run commands on several files at once. For instance, if you want to invert colors of all png files in a directory, and save them as jpg, you could run:
gimp -i -b '(with-files "*.png" (gimp-invert layer) \
             (gimp-file-save 1 image layer \
             (string-append basename ".jpg") \
             (string-append basename ".jpg") ))'
             
**quiet rant** Gimp really needs some sort of macro facility that does not rely on command line or writing a script. Tried all ways with BIMP but it just does not handle .xcf files with several layers.
Reply


Messages In This Thread
Gimp 2.10 'with files' batch - by rich2005 - 11-15-2018, 11:34 AM
RE: Gimp 2.10 'with files' batch - by Ofnuts - 11-15-2018, 01:53 PM

Forum Jump: