So you have a nice new fancy icon to add as an inventory icon, maybe even for a weapon part.

These should usually have black outlines are per the base game models.

In GIMP the best option is to use the Drop Shadow option.

Example: 512x512 icon, we isolate the icon and on a transparent background. If possible make the icon slightly smaller than the space, but tbh it won't matter a great deal if the shadow touches the edges.

Choose the Drop Shadow filter under Light and Shadow.

The defaults do, well, a shadow. But we want it to be a bit different.

We use these settings:

  • X/Y: 0 - this centres the shadow not offsets it
  • Blur Radius - 2.0 - less "fade" and transparency at the edges of the shadow. 2.0 is a small amount.
  • Grow Shape: Default Circle works fine - bit more smooth and rounded corners
  • Grow radius: 8 - This gives the black thickness. Increase or decrease to suit. 8 seems pretty reasonable. Note this needs changing depending on the icon size to be a suitable amount. Eg: 256x256 (or so) image would be 4.
  • Opacity: 1.5 - This makes the 8 width line mostly opaque
  • Clipping: Adjust: Default (Adjust)
  • Blending mode: Defaults (Replace/100.0)

This is the final effect:

Save this by hitting OK it will add it to the image.

It can sometimes look a bit odd on things with transparency in built but it isn't the worst, and could be edited to suit (eg cut the icon off where transparent parts start).

Bulk GEGL BIMP / GIMP Work

To apply this change to lots of images - eg lots of item icons - you can use a combination of GIMP and BIMP and a plugin for it.

Plugin zip: for_gegl.zip - put the files in a plug-ins folder eg: C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins

Install BIMP too: https://github.com/alessandrofrancesconi/gimp-plugin-bimp/releases/

Once installed in BIMP you can now access the way to run GEGL commands via the python plugin.

Open BIMP by File → Batch Image Manipulation...

Then add Other GIMP procedure:

Search gegl and select the python one:

Input the graph string, this will be applied to the image. For instance for this procedure it is drop shadow depending on the image size grow-radius needs to change:

 # 256 looks a bit better with 4 - but needs further testing
dropshadow time=0 x=0 y=0 radius=2 grow-shape=circle grow-radius=4 color=#000000 opacity=1.5
 
# 128 x 128 upscaled seems to suit 6
dropshadow time=0 x=0 y=0 radius=2 grow-shape=circle grow-radius=6 color=#000000 opacity=1.5

# Many seem to fit 8 as a default
dropshadow time=0 x=0 y=0 radius=2 grow-shape=circle grow-radius=8 color=#000000 opacity=1.5

EG:

Finally set your other parameters in BIMP eg output format, what images you want to process and the output folder. Then run it and it should run the commands through.

You could apply multiple actions one after another if you wanted to run more than one aspect (eg resizing, then doing it, or doing it then resizing, or some other GEGL command).

Testing Python GEGL

You can find different GEGL documentation including the important key words on this website: https://gegl.org/operations/

You can test the filters directly in the Filters menu, and export the settings to get some idea about the numbers. However some do not translate from import/export (eg; "color" can be just defined as a hex number).

The line for the gegl command should be in quotes and spaces between parameters and parameter=XXXX as the way of defining them.

To test, in the python console (Filters → Python-fu → Console) you can load the gegl commands to test on the current image with two lines of code:

image = gimp.image_list()[0]
pdb.python_gegl(image, image.active_layer, "dropshadow time=0 x=0 y=0 radius=2 grow-shape=circle grow-radius=4 color=#000000 opacity=1.5")

This gets the first open image to test on and the active layer to apply it to. You might need to alter those two parameters to test a more complex (eg PLT/multi-layer) combination.

In this example I've run it once outside the python window and once in it so it's a very, very big drop shadow! but you get the idea. The console will error if there is anything missing in general, but the gegl command if it has bad parameters tends to just not run, or to use default values instead.

You can likely write entire python scripts invoking GIMPs python API to do this kind of thing. But after a few days to scrounge enough information to do this (and using random zips on the web, always fun! thanks GIMP! please integrate the python-gegl plugin at least sometime!) I'm just happy it works.

  • No labels