It is currently Tue Jul 02, 2024 3:05 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Can a python script use gimpfu, run from terminal, and create new img?
PostPosted: Thu Feb 03, 2022 11:29 pm  (#1) 
Offline
New Member

Joined: Feb 03, 2022
Posts: 2
I want to make a python script that will use gimp for some of the processing steps and export as jpeg/png.
In my limited google searching, they say python scripts need to be run inside gimp and cannot be used from the terminal.
..But, I'm having a hard time believing that.

I was planning to create a python file that will look through some folders of images, read some metadata of preferences from a csv, with gimp modify the image sizes, put images side by side (in a grid) according to some preferences, output as a single png in another relative path location

Can I use gimpfu from within a larger python file from the terminal to do this? and if so, are there tutorials/documents for this?

Thanks

Current version of gimp 2.10.14, python 3.7.4


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Can a python script use gimpfu, run from terminal, and create new
PostPosted: Fri Feb 04, 2022 3:10 am  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
The script bit need to be run from Gimp. Gimp isn't designed to be an image processing library, but to be a GUI image editor. So your Python script would have to explicitly start Gimp, and give it the script to run, and possibly a source directory, see here(just repalce .BAT/sheel by Python).

Another solution is to write a Gimp script/plugin, and start it from inside Gimp.

But IMHO if you are in Python, there are plenty of image libraries that can do this, such as Pillow. You can also use ImageMagick, either by calling as a command or using its python bindings. Using Gimp for this is really one of the most complicated ways I can imagine.

_________________
Image


Top
 Post subject: Re: Can a python script use gimpfu, run from terminal, and create new
PostPosted: Sat Feb 05, 2022 2:00 pm  (#3) 
Offline
New Member

Joined: Feb 03, 2022
Posts: 2
I see, thanks for the pillow suggestion im reading about it more now.


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) Create a red heart script

16

No new posts .py script not showing under Python-Fu

3

No new posts Attachment(s) My first Python Script for Gimp

7

No new posts Attachment(s) Learning to do first Python script

6

No new posts Does anyone have script fu and python plugins that work on 2.99.19?

1



* Login  



Powered by phpBB3 © phpBB Group