Multifill, flatting tools for comics and illustrations, fast and python only - 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: Multifill, flatting tools for comics and illustrations, fast and python only (/Thread-Multifill-flatting-tools-for-comics-and-illustrations-fast-and-python-only) |
Multifill, flatting tools for comics and illustrations, fast and python only - inkdolls - 10-30-2024 I wrote a plugin long ago to help me in coloring comic pages: 1: Outline image darkened a bit (to minimize gaps) and converted to two bit indexed black and white. 2: Multifill filter fills with random colors. 3: Outlines removed with flatten filter. [attachment=12504] Random colors replaced. Outline added back as a layer in multiply mode. Shading applied. [attachment=12505] I wrote this in 2013 and I regret not having shared it, the only other option was a very slow script on the Gimp Registry. I wrote mine with its own logic not using any Gimp features except access to image data. I wrote it in C and it's fast, even on old 32 bit machines. But I never dared to show my C code and I couldn't have compiled anything on other platforms but Linux. Only very recently I found out by accident about the low level access to gimp images with Python. I ported the code just to try. The result is not as fast, but it's quite reasonable, taking a few seconds and not minutes or hours to finish. My script is dumb, it can't find gaps or merge small areas with the surrounding ones, someday maybe. I know Gimp now has filling with line art detection and there's also an advanced "smart coloring" GMIC filter. But the workflow with line art detection is not great for me, I have to work faster. And being Qt based, gimp-gmic requires that I install 44 packages and use extra 107 MB of disk, versus my tiny plugins that only take a few Kb. [attachment=12506] The flatting tool (edge removal) is copied from the one written by Rob Antonishen that uses the dilate filter, in this case my code would be slower in python. RE: Multifill, flatting tools for comics and illustrations, fast and python only - Ofnuts - 10-30-2024 Nice... Hard to avoid all Qt-based apps so sooner or later you are going to install the Qt support (me, I'm on KDE so Qt support is a given). And what is 104MB these days? I have Gimp XCF files bigger than this :-) RE: Multifill, flatting tools for comics and illustrations, fast and python only - inkdolls - 10-31-2024 (10-30-2024, 05:04 PM)Ofnuts Wrote: Nice... Yeah, I miss the old KDE that allowed different desktop backgrounds... But I use XFCE now. And you're right about the file size, images can quickly fill several GB, even compressed. RE: Multifill, flatting tools for comics and illustrations, fast and python only - denzjos - 11-05-2024 (10-30-2024, 02:44 PM)inkdolls Wrote: I wrote a plugin long ago to help me in coloring comic pages: Good job. Works fine on windows 10 / gimp 2.10.38. RE: Multifill, flatting tools for comics and illustrations, fast and python only - inkdolls - 11-05-2024 (11-05-2024, 11:42 AM)denzjos Wrote: Good job. Works fine on windows 10 / gimp 2.10.38. Thanks! By the way, if somebody gets distorted results like this, I think there's a bug in the python interpreter: [attachment=12549] [attachment=12550] For two-bit indexed images with alpha channel, the script gets the wrong bits per pixel, so either remove the alpha channel or convert to rgb. RE: Multifill, flatting tools for comics and illustrations, fast and python only - PixLab - 11-06-2024 (11-05-2024, 11:54 PM)inkdolls Wrote:(11-05-2024, 11:42 AM)denzjos Wrote: Good job. Works fine on windows 10 / gimp 2.10.38. No a bug in python, Looks like an indexed/rgb problem, put it RGB it's on the code multifill (line 119) is "RGB*, GRAY*, INDEXED*", BUT flatten colors (line 150) is only "RGB*, GRAY*", (no indexed) RE: Multifill, flatting tools for comics and illustrations, fast and python only - inkdolls - 11-07-2024 So, I seem to have fixed the distortion issue. I can't edit my previous posts, it's not great to not have some external repository, so I just hope this will be noticed. This is a fixed version, sorry about that: [attachment=12564] (11-06-2024, 05:54 AM)PixLab Wrote: No a bug in python, Um, that part on line 150 is copied from an old script. It doesn't have to match the previous declaration since it's for another plugin. I did test and adding INDEXED* makes Gimp go into an infinite loop if an actual indexed image is used. But thanks for making me look at he code again. GImp is not reporting a wrong bites per pixel number. I was storing it before a possible conversion to rgb, in which case it would not be valid anymore. |