Processing XCF files in batch - 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) +---- Forum: Scripting questions (https://www.gimp-forum.net/Forum-Scripting-questions) +---- Thread: Processing XCF files in batch (/Thread-Processing-XCF-files-in-batch) Pages:
1
2
|
RE: Processing XCF files in batch - Mate de Vita - 12-12-2022 (12-11-2022, 04:55 PM)Ofnuts Wrote: Just replace This seems to have done the trick, thanks. RE: Processing XCF files in batch - Mate de Vita - 12-15-2022 So it turns out there's one more problem I've discovered with some of the XCF files, where locking the alpha channel prevents some of the coloured pixels from being filled. I confirmed this by opening the files manually in GIMP and trying to bucket fill them. Doing so with the alpha channel unlocked worked fine, but if I locked the alpha channel, they wouldn't get bucket-filled. My guess is some of the red/green/blue pixels have non-0 non-255 values of alpha (I can't see alpha values in GIMP's colour picker tool though to confirm this). I have no idea how this was introduced to the images, but I have managed to replicate the issue using a layer mask. I've attached a sample project that shows the issue - bucket filling the Arm layer works fine, but if you lock the alpha channel, you can't fill it any longer. Is there a way to adapt the script to handle this problem, so that partially transparent pixels in the layers are still filled and only the fully transparent pixels are ignored? For reference, my current script looks like this in full (I've made some minor adjustments to address some other issues in the images, such as hidden layers, wrong layer names, and saved selections): Code: from gimpfu import * RE: Processing XCF files in batch - Ofnuts - 12-16-2022 I don't see such a problem. If you are talking about the partially transparent area in the arm (covering the thumb), then the layer color has been replaced. However, since the layer is partially transparent, the color picker will report the blend of the color and whatever color is below if the Sample merged option is checked. If you uncheck the option, you get the actual color in the layer. Here is what I see (I use the Pointer dialog to explore the image, faster and more options than the color picker) [attachment=9166]
RE: Processing XCF files in batch - Mate de Vita - 12-16-2022 I see.. Yes, I also get pure blue if I uncheck Sample merged in the colour picker. But the issue still remains, I'd like to remove this transparency from the partially transparent pixels in the layer. I.e. I'd like all the pixels in the red/green/blue layers to be either fully transparent or fully opaque red/green/blue (i.e. RGBA 255/0/0/255, 0/255/0/255, and 0/0/255/255). Is this possible to accomplish from the script? I tried replacing gimpcolor.RGB(255, 0, 0) with gimpcolor.RGBA(255, 0, 0, 255) but that threw an error. RE: Processing XCF files in batch - Ofnuts - 12-16-2022 (12-16-2022, 11:45 AM)Mate de Vita Wrote: I see.. Yes, I also get pure blue if I uncheck Sample merged in the colour picker. But the issue still remains, I'd like to remove this transparency from the partially transparent pixels in the layer. I.e. I'd like all the pixels in the red/green/blue layers to be either fully transparent or fully opaque red/green/blue (i.e. RGBA 255/0/0/255, 0/255/0/255, and 0/0/255/255). Is this possible to accomplish from the script? I tried replacing gimpcolor.RGB(255, 0, 0) with gimpcolor.RGBA(255, 0, 0, 255) but that threw an error. Try pdb.plug_in_threshold_alpha(image, layer, threshold), with suitable threshold value. But you may get pixellated edges. |