Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python-fu basics: importing and exporting files
#1
Hi, I am sorry if this is a duplicate question. I did my best to check for topics that answered my question, but I'm still a little lost.

What I am trying to do:
load an image from folder_1,
do some transformation to it (this part I understand well enough),
save the image to folder_2 (I can do this using some code I found)

Where I am getting stuck:
my syntax for loading the file seems to be wrong.
It's not showing up in the file menu, which I assume means that I'm missing some essential lines.

I found some code that works to save the file, so I will omit that from my code sample.

This is basically what I have.



#!/usr/bin/python
from gimpfu import *

def load_file():

    path = "C:\Users\User\Pictures\GIMP\folder_1\01.png"
    filename = path
    raw_filename = path
    image = pdb.file_png_load(filename, raw_filename)


register(
    proc_name = ("python-fu-load"),
    blurb = ("load file"),
    help = ("imports png from 'new folder' with the name 01"),
    author = ("REC"),
    copyright = ("REC"),
    date = ("2022"),
    label = ("load file"),
    imagetypes = ("*"),
    parameters = [
        (PF_IMAGE, "image", "takes current image", None),
        (PF_DRAWABLE, "drawable", "input layer", None)
        ],
    results = [],
    function = (load_file),
    menu = ("<image>/Layer")
    )

main()




I know that I'm missing something very basic, but I haven't been able to find an example that simply loads a file to work on using python-fu.
I would love to get my hands on some basic utility plugins or examples written for python-fu, if I have something to reference I can probably figure out what I need.

Thank you for reading this.
Reply


Messages In This Thread
Python-fu basics: importing and exporting files - by Xeroxide - 10-24-2022, 04:15 AM

Forum Jump: