![]() |
|
1st plugin attempt - save jpeg question - Printable Version +- Gimp-Forum.net (https://www.gimp-forum.net) +-- Forum: GIMP (https://www.gimp-forum.net/Forum-GIMP) +--- Forum: Extending the GIMP (https://www.gimp-forum.net/Forum-Extending-the-GIMP) +--- Thread: 1st plugin attempt - save jpeg question (/Thread-1st-plugin-attempt-save-jpeg-question) |
1st plugin attempt - save jpeg question - nmw01223 - 01-18-2026 I am embarking on my 1st (python) plugin using GIMP 3. I'm a long term (basic) Photoshop user and have a lot of software design experience - but virtually no GIMP experience and zero python experience. So, it's a bit of a learning curve. What I'm doing is pretty simple, replicating something I used to do with Photoshop using VB (OLE) automation. Basically, a batch process - need to point to a source directory containing images of various types and resolutions (TIF, PSD, JPG etc), then to load them one by one, perform some basic (automatic) changes, and write them out one by one as JPEGs to a different directory. I've got the basic plugin shell going, with a dialog to select directories etc, define the automatic changes and so on, and it seems to work fine. I think I can see how to get the source filenames using scandir() imported from os. Now looking at loading the files and writing the JPEGs. I assume I can use Gimp.file_load() to load an image. But, when one writes a JPEG, there are usually some parameters - the JPEG level for file compression to start with. I cannot see any function for doing that. I found Gimp.file_save(run_mode, image, file, options), but it says options isn't used. I really don't want it to pop up a dialog to set these things. So my basic questions are, is file_load() the right way to load an image, and how do I save a JPEG setting all necessary parameters programmatically? |