Gimp-Forum.net
Top Layer of Camo Generator Transparent? - 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: Top Layer of Camo Generator Transparent? (/Thread-Top-Layer-of-Camo-Generator-Transparent)



Top Layer of Camo Generator Transparent? - Pixel_Outlaw - 08-09-2022

Hello All,

I was excited to see GIMP supports Scheme so I took a crack at generating some procedural camouflage.
Overall it was easy and I'm happy with my effect.
There seems to be one slight error and that is that my topmost layer seems to be drawn transparent if you use my default colors when running the script.
To run the script open a fresh blank image and then select the script.
[Image: LRU0DWp.png]


My code is here:
https://github.com/RyanBurnside/gimp-camo/blob/main/camo.scm

The xcf image in question I'll attach.

If you disable all layers except for the first you'll see you can see the checkerboard showing through.

https://imgur.com/LRU0DWp.png


RE: Top Layer of Camo Generator Transparent? - PixLab - 08-09-2022

Strange Indeed,
No programmer here, just reporting what I experienced
Line 13: I did put 23 instead of 22 and no more transparency... (I tried with the number 3 instead of 2 on the last argument ➤ still transparency)

[attachment=8464]

Also your script is not able to be called back with CtrL+F / Shift+Ctrl+F if we use it first, we need to use another filter/script, then we will be able to call it back in the Filters ➤ Recently used and then we can do a Ctrl+F

[attachment=8465]


RE: Top Layer of Camo Generator Transparent? - Ofnuts - 08-09-2022

Problem doesn't appear if your layer has a color different from black. In fact you use black in other layers, they are left completely transparent.This is because you do a selection on black before the cut....

But your process is contrived, so summarize:
  • generate random black and white pattern with solid noise+threshold
  • replace white with color
  • get a selection on black
  • cut out the black and leave the color
It is simpler/faster (and doesn't leave you with a stickiness on black) to:

  • generate random black and white pattern with solid noise+threshold
  • make it a selection
  • bucket fill the layer with chosen color

This is easy if you add a channel, apply the solid-noise+threshold on it, then get a selection from it with gimp-image-select-item. The channel can be re-used for all layers.


RE: Top Layer of Camo Generator Transparent? - Pixel_Outlaw - 08-10-2022

@PixLab I'll check into this.

@Ofnuts
Thank you!
I will try the alternative suggestion though when I get a chance, maybe tomorrow. (Work has been taking my time today)

Is there a bug in the wrapper though? I guess I'm not 100% clear on that.