Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,645
» Latest member: Josephdeaft
» Forum threads: 7,186
» Forum posts: 39,250

Full Statistics

Latest Threads
Can not make bookmarks fo...
Forum: Installation and usage
Last Post: Ofnuts
7 hours ago
» Replies: 3
» Views: 109
Save & Export?
Forum: General questions
Last Post: Ofnuts
7 hours ago
» Replies: 1
» Views: 49
Bookmarks are not saved
Forum: Linux and other Unixen
Last Post: Ofnuts
8 hours ago
» Replies: 3
» Views: 99
scriptfu could says what ...
Forum: Scripting questions
Last Post: rich2005
Yesterday, 12:01 PM
» Replies: 2
» Views: 129
adding UnitComboBox to a ...
Forum: Scripting questions
Last Post: Ofnuts
Yesterday, 07:05 AM
» Replies: 1
» Views: 95
Gimp make jpg to Webp 100...
Forum: General questions
Last Post: estatistics
02-24-2025, 09:30 PM
» Replies: 8
» Views: 257
Eraser Stopped Working
Forum: General questions
Last Post: Ofnuts
02-24-2025, 07:55 AM
» Replies: 9
» Views: 293
select outline
Forum: General questions
Last Post: sallyanne
02-24-2025, 02:38 AM
» Replies: 2
» Views: 120
I can't edit a path
Forum: General questions
Last Post: Ofnuts
02-23-2025, 08:38 AM
» Replies: 2
» Views: 133
gradients semi transparen...
Forum: General questions
Last Post: Ulodesk
02-22-2025, 05:00 PM
» Replies: 3
» Views: 207

 
  pixel perfect squares
Posted by: gimpygirl - 03-04-2024, 02:55 AM - Forum: Extending the GIMP - Replies (6)

Hi

If you followed my font journey (hihi Big Grin ) in other posts: I have extracted a font sprite but it's not a perfect square.
What plugin or gimp operation I can apply to this image to make it a perfect square (it should be a 8x8 pixel square). So as a result the shape of the A is changed so it fits the perfect square (that's the goal!)
The black at the left and the bottom is PART of the square, because it's spacing for the font. It should not be removed.

This image is a separate layer of my image and I have layers for A -> Z and 0 -> 9. They all need to be adjusted.



Attached Files Image(s)
   
Print this item

  flip images
Posted by: gimpygirl - 03-04-2024, 02:37 AM - Forum: Extending the GIMP - Replies (6)

Hi

See image

- from this image I generate layers: each layer is a square of the image. So the layers have the symbols as you see them (wrong orientation).

- I need an existing plugin or plugin code to flip the layers so they are in correct orientation. How can I do this with existing plugin or plugin code or gimp operation?
(only for A -> Z and 0 -> 9)



Attached Files Thumbnail(s)
   
Print this item

  ofn-tiles : example image
Posted by: gimpygirl - 03-03-2024, 07:56 PM - Forum: Scripting questions - Replies (5)

How to extract the tiles (the fonts) of this specific image using ofn-tiles ?
It are not squares


And if it's not possible using ofn-tiles , then I can only do it using below?

- making guides between the tiles
- python_fu_ofn_guillotine_layer
- python_fu_ofn_export_layers

Or is there another more easy way with script/plugin that is available somewhere?

Can I do this with gmic?



Attached Files Thumbnail(s)
   
Print this item

  VS code using python of GIMP
Posted by: gimpygirl - 03-03-2024, 06:26 PM - Forum: Extending the GIMP - Replies (1)

Hi

This is not a real GIMP question but related to using the python used by GIMP.
I have windows 10, only GIMP is installed and I didn't install any python. Still I can use python in GIMP, so this means somewhere GIMP has python included?
Where is it?

I installed visual studio code and the python extension

https://code.visualstudio.com/

https://marketplace.visualstudio.com/ite...hon.python

But when i open a gimp plugin file, many errors.
Does anybody know how to make vs code detect he python used by GIMP so the errors are gone?

See error on screenshots


Many settings for the python extension for vs code, but what to change and how?



Attached Files Thumbnail(s)
           
Print this item

  Dynamics
Posted by: Ofnuts - 03-03-2024, 04:34 PM - Forum: Tutorials and tips - Replies (1)

Dynamics are a way to change some brush charactertistic(s) in the fly using more hints than just the pointer position. The hints are:

  • Pressure: the pressure on the stylus (this requires an adequately configured tablet)
  • Velocity:  how fast the pointer moves
  • Direction:  where the pointer goes
  • Tilt:  inclination of the stylus, on advanced tablets
  • Wheel/rotation:  I don't know what that is but I assume this is also for advanced tablets
  • Random: not a physical input, just a random value between 0 and 100%
  • Fade: the distance since the beginning of the stroke, as a percent of the Fade length configured in the paint tool (this repeats)
In practice with a mouse the only usable ones are Direction, Random, and  Fade (and Velocity if you are really skilled).

These hints can be applied to the following characteristics:
  • Opacity: from 0 to 100% of configured opacity
  • Size: from 0 to 100% of the configured brush size
  • Angle: from 0° to 360°: warning: the median setting is 180°, which is an upside-down brush, so for some mapping it is useful to use an upside-down brush.
  • Color: a color is sampled from the active gradient
  • Hardness
  • Force
  • Aspect ratio: from "0" (circular brush) to whatever is configured for the brush
  • Spacing: from 200% spacing to the configured spacing
  • Rate
  • Flow
  • Jitter
You define all this by editing/creating a Dynamics (as with other Gimp resources, you cannot edit the standard one, you have to make a copy first).

The first thing to do in a Dynamic is to define the mapping matrix. To control a given characteristic using a given hint, you just check the box that is at the intersection of the "hint" and the "characteristic". The example below associates Size with Random (so the size is random), and the Color with Fade (so the color is taken from a gradient as the pointer advances). A hint can apply to several characteristics (so you could have random size and color) and a characteristic can depend on several hints (but good luck predicting how this behaves).

   

You can define more finely how the hint is applied to change the characteristic by changing the mapping curve:

   

For instance, in the image above, the red-green part of the gradient is mapped to smaller part of the input range than the green-blue part, while the blue-red is not mapped at all, so the output favors mostly the green-blue part.

Gimp comes if a  collection of pre-set dynamics, a very useful one is Track direction, where the brush angle is rotated according to the stroke direction, so the brush keeps the same orientation relative to the stroke instead of remaining upright all along.

   

Print this item

  Dynamics
Posted by: sallyanne - 03-03-2024, 08:41 AM - Forum: General questions - Replies (10)

Something I hardly use when using a brush or anything else. Because I have no idea about it. Just track direction and dynamics off.
I have never seen a Tutorial on them except the one Pix made at GC recently. But have no idea how to create new ones - and/or use them.
I may use them more or may not if someone could come up with a tutorial on them - maybe explain them etc. please.

Print this item

  simulate debug breakpoints
Posted by: gimpygirl - 03-03-2024, 01:56 AM - Forum: Extending the GIMP - Replies (5)

Hi

Since it's not possible to debug a plugin on windows (maybe it can on linux?) I want to make a way to 'pause' execution of a plugin. Why I want to do that? I want to check in gimp if some code was executed correctly.
For example: I add an alpha channel to a layer in the code, and I then want to 'pause' and check in gimp if it's added by right clicking the layer. And then continue my code.

Is there a way I can pause the code by showing a message box (after the code line I want it to stop) or something that needs to be closed before the code continues? Or another way? Keyboard input is not possible I think?
Please note I'm making a plugin WITHOUT GUI.

Print this item

  drawable
Posted by: gimpygirl - 03-02-2024, 11:10 PM - Forum: Scripting questions - Replies (1)

What can a drawable be. A layer, what else?
Any docs page where I can read?

There is this

https://developer.gimp.org/api/2.0/libgi...mpDrawable

but it doesn't tell me all possible things that can be a drawable.
I don't understand it completely  Blush

Print this item

  Help with color change
Posted by: rinaldop - 03-01-2024, 11:44 PM - Forum: General questions - Replies (3)

Hello everyone,

I am back with what I hope is a simple question. I would like to turn the red pill shaped areas in the image below from red to black two at a time all the way down. Thank you for any tips!

   

   

   

Print this item

Python Python Plug-in that Changes SubLayers Visibility and Export Images as PNG Files
Posted by: TiredGuy - 03-01-2024, 10:24 PM - Forum: Scripting questions - Replies (2)

Hello everybody!
I’m not very good not in GIMP, nor in Python, nor English, so please excuse me for my mistakes)

I have a .xcf file with a lot of layers and sublayers, for example:

(visible)        Layer_1
(visible)            Sublayer_1.1
(invisible)          Sublayer_1.2
(visible)        Layer_2
(invisible)        Sublayer_2.1
(invisible)        Sublayer_2.2
(invisible)        Sublayer_2.3
(visible)        Layer_3

I need to change the visibility of each sublayer in a selected layer in turn and export the entire image with all visible layers.

For example:

(visible)        Layer_1
(visible)            Sublayer_1.1
(invisible)          Sublayer_1.2
(visible)        Layer_2
(visible)         Sublayer_2.1
(invisible)        Sublayer_2.2
(invisible)        Sublayer_2.3
(visible)        Layer_3

Export image_2.1.png

then

(visible)        Layer_1
(visible)            Sublayer_1.1
(invisible)          Sublayer_1.2
(visible)        Layer_2
(invisible)      Sublayer_2.1
(visible)         Sublayer_2.2
(invisible)        Sublayer_2.3
(visible)        Layer_3

Export image_2.2.png

then 

(visible)        Layer_1
(visible)            Sublayer_1.1
(invisible)          Sublayer_1.2
(visible)        Layer_2
(invisible)        Sublayer_2.1
(invisible)      Sublayer_2.2
(visible)         Sublayer_2.3
(visible)        Layer_3

Export image_2.3.png


The best that I did with the help of ChatGPT is this plug-in in Python:

Code:
#!/usr/bin/env python

from gimpfu import *

def export_sublayers(image, drawable, layer_name, path, prefix):
   # Find the target layer
   target_layer = None
   for layer in image.layers:
       if layer.name == layer_name:
           target_layer = layer
           break

   # If the target layer is found
   if target_layer:
       # Iterate through sublayers
       for sublayer in target_layer.children:
           # Make the current sublayer visible and others invisible
           for child in target_layer.children:
               pdb.gimp_item_set_visible(child, child == sublayer)

           # Export the image
           path = path + "\\" if not path.endswith("\\") else path
           filename = path + prefix + "_" + sublayer.name + ".png"
           pdb.file_png_save_defaults(image, image.active_layer, filename, filename)

       # Make all sublayers visible again
       for sublayer in target_layer.children:
           pdb.gimp_item_set_visible(sublayer, True)

register(
   "python_fu_combine_layers_and_export",
   "Combine layers and export",
   "Combine layers and export",
   "Your Name",
   "Your Name",
   "2024",
   "<Image>/File/Combine layers and export",
   "*",
   [
       (PF_STRING, "layer_name", "Layer name", ""),
       (PF_DIRNAME, "path", "Export path", "/path/to/export/"),
       (PF_STRING, "prefix", "Prefix", "")
   ],
   [],
   export_sublayers)

main()

But this plug-in exports only sublayers in a selected layer and I can't make it export the entire image with all visible layers.

Is anybody able to help me with it, please?

Or maybe are there other ways to do it?

Many thanks for any help!

Print this item