Gimp-Forum.net
i want to write a xcf file creation plugin - 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: i want to write a xcf file creation plugin (/Thread-i-want-to-write-a-xcf-file-creation-plugin)



i want to write a xcf file creation plugin - plexigras - 12-17-2016

i have multiple directory's containing images all of them should get converted to xcf files and if there are files with the same name in another directory the xcf file should have all of them as layers.

as an example:

input_a/1.png
input_b/1.png
input_c/1.png

get converted into

output/1.xcf

which contains 3 layers called input_a, input_b and input_c.

any help would be appreciated.

like why dose this plugin not work?
https://www.gimp.org/tutorials/AutomatedJpgToXcf/

or are there other plugins i should take a look at?

or anything really. Smile


RE: i want to write a xcf file creation plugin - Ofnuts - 12-17-2016

How do you specify which name you want (ie. 1, 2, 3)? Is this supposed to run as batch (generate all possible images)? Or do you need something that will add the "sibling" images to the currently open image?


RE: i want to write a xcf file creation plugin - plexigras - 12-17-2016

(12-17-2016, 02:23 PM)Ofnuts Wrote: How do you specify which name you want (ie. 1, 2, 3)? Is this supposed to run as batch (generate all possible images)? Or do you need something that will add the "sibling" images to the currently open image?

input_1, input_2 and input_3 are the directory's i want to run the script on.

for all the images inside of all dirs (maybe even recursively) a xcf file should be created in the output directory.


RE: i want to write a xcf file creation plugin - Ofnuts - 12-18-2016

See ofn-coalesce-images.
  • It adds a "Coalesce images" at the bottom of the File menu
  • When you hit it, you get a dialog asking for two directories:
    • The root of all the directories with the input files
    • The directory where the XCF will be saved (recommendation: not in the input tree)
  • The script scans all files under the root tree, and attempts to create XCF files by stacking all the file with the exact same name in the varoius directories.
Warnings:
  • More of the "full-speed ahead and damn the torpedoes" kind. Doesn't catch errors or try graceful recovery.
  • Files should have the very same name (no case variations) and extension.
  • Layers are stacked in directory name order (bottom being first).
Enjoy


RE: i want to write a xcf file creation plugin - plexigras - 12-26-2016

(12-18-2016, 08:17 PM)Ofnuts Wrote: See ofn-coalesce-images.
  • It adds a "Coalesce images" at the bottom of the File menu
  • When you hit it, you get a dialog asking for two directories:
    • The root of all the directories with the input files
    • The directory where the XCF will be saved (recommendation: not in the input tree)
  • The script scans all files under the root tree, and attempts to create XCF files by stacking all the file with the exact same name in the varoius directories.
Warnings:
  • More of the "full-speed ahead and damn the torpedoes" kind. Doesn't catch errors or try graceful recovery.
  • Files should have the very same name (no case variations) and extension.
  • Layers are stacked in directory name order (bottom being first).
Enjoy

this is amazing. with some slight adjustments its even exactly what i wanted which i didn't think was possible. but i was wrong  Big Grinhttps://gist.github.com/plexigras/d07a37ccb6657202457dc3c6f0b7a600

thank you sooooooooo much.

i modified it so it replicates the file structure and supports infinite amounts of input directory's by making it so you have to place/link the input directory's in to the root folder.


RE: i want to write a xcf file creation plugin - Ofnuts - 12-26-2016

Happy to help... may I attract your attention to the following two lines in the file:

Code:
#   If you make and redistribute changes to this code, please mark it
#   in reasonable ways as different from the original version.


... which are a reminder of the Section 5 Conveying Modified Source Versions of the GPLv3 licence, which you agreed to implicitly by using and redistributing the code.

IMHO this means:

1) remove me as the main author (I can still be credited...)
2) replace the "ofn-" prefix in the file name and the registration procedure (because they are my own identifiers...)

Thanks.


RE: i want to write a xcf file creation plugin - plexigras - 12-26-2016

(12-26-2016, 01:40 PM)Ofnuts Wrote: Happy to help... may I attract your attention to the following two lines in the file:

Code:
#   If you make and redistribute changes to this code, please mark it
#   in reasonable ways as different from the original version.


... which are a reminder of the Section 5 Conveying Modified Source Versions of the GPLv3 licence, which you agreed to implicitly by using and redistributing the code.

IMHO this means:

1) remove me as the main author (I can still be credited...)
2) replace the "ofn-" prefix in the file name and the registration procedure (because they are my own identifiers...)

Thanks.
https://gist.github.com/plexigras/d07a37ccb6657202457dc3c6f0b7a600/revisions
better?


RE: i want to write a xcf file creation plugin - Ofnuts - 12-26-2016

(12-26-2016, 04:23 PM)plexigras Wrote:
(12-26-2016, 01:40 PM)Ofnuts Wrote: Happy to help... may I attract your attention to the following two lines in the file:

Code:
#   If you make and redistribute changes to this code, please mark it
#   in reasonable ways as different from the original version.


... which are a reminder of the Section 5 Conveying Modified Source Versions of the GPLv3 licence, which you agreed to implicitly by using and redistributing the code.

IMHO this means:

1) remove me as the main author (I can still be credited...)
2) replace the "ofn-" prefix in the file name and the registration procedure (because they are my own identifiers...)

Thanks.
https://gist.github.com/plexigras/d07a37ccb6657202457dc3c6f0b7a600/revisions
better?

Yes, but not perfect yet:

Code:
register(

'ofn-coalesce-images',

'Coalesce images with same name in a directory tree into a single XCF',

'Coalesce images with same name in a directory tree into a single XCF',

'Ofnuts','Ofnuts','2016',

'Coalesce images',