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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,989
» Latest member: jhmiii
» Forum threads: 7,400
» Forum posts: 40,297

Full Statistics

Latest Threads
Do I have to create a fl...
Forum: General questions
Last Post: blogsofwardotme
16 minutes ago
» Replies: 2
» Views: 68
Automatic selection tool
Forum: General questions
Last Post: rich2005
5 hours ago
» Replies: 1
» Views: 56
Color fill into pasted la...
Forum: General questions
Last Post: RealGomer
6 hours ago
» Replies: 2
» Views: 161
RawTherapy to Gimp
Forum: General questions
Last Post: doiphoto
8 hours ago
» Replies: 2
» Views: 89
Recent folders missing fr...
Forum: Gimp 2.99 & Gimp 3.0
Last Post: rich2005
9 hours ago
» Replies: 1
» Views: 73
Is there a way to use *.8...
Forum: Gimp 2.99 & Gimp 3.0
Last Post: denzjos
11 hours ago
» Replies: 2
» Views: 89
crop and straighten photo...
Forum: General questions
Last Post: denzjos
Yesterday, 10:51 AM
» Replies: 6
» Views: 213
Arrow Script
Forum: Extending the GIMP
Last Post: Chris Thompson
05-08-2025, 07:48 PM
» Replies: 133
» Views: 169,043
ofn3-layer-tiles
Forum: Extending the GIMP
Last Post: karaxus
05-08-2025, 10:53 AM
» Replies: 7
» Views: 1,056
Slowing down
Forum: General questions
Last Post: rich2005
05-08-2025, 10:33 AM
» Replies: 2
» Views: 231

 
  Did GIMP 3.0.2 Break Plugins Again?
Posted by: n3306tx - 03-25-2025, 04:10 AM - Forum: Scripting questions - Replies (3)

Apparently GIMP 3.0.0 had an issue with the initial installation file where the python console was missing and python plugins were affected and not showing in the menus.  GIMP 3.0.1 was released and fixed this problem.  GIMP 3.02 with additional bug fixes was released and now python plugins no longer are showing in the menu.  I reinstalled GIMP 3.0.1 and the plugins are back in the menus.

Print this item

  Alternative to Drawable.get_tile() for Gimp 3?
Posted by: joeyeroq - 03-25-2025, 01:21 AM - Forum: Scripting questions - Replies (6)

I'm trying to port a Gimp 2 script to Gimp 3 and got most of it figured out by trying stuff out in the python console.


Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import time
from gimpfu import *

def sprites2layers(image, layer, sample, minimal_dimensions):
    '''
    "Separates objects on one layer to their own layer. Handy for Spritesheets"
    
    Parameters:
    image -- The current image.
    layer -- The layer of the image that is selected.
    sample -- sample every nth pixel of layer tile
    minimal_dimensions -- minimal dimension of object to be placed in "objects" layer group
    '''
    # Start timer
    time_start = time.time()

    # Check image type (RGB/Greyscale or Indexed) and if layer has alpha, if not stop this script with a warning
    no_alpha_warning='This layer has no alpha, please add an alpha channel for this script to work'
    if image.base_type == 0:
        image_mode = 'RGB'
        if layer.bpp != 4:
            gimp.message(no_alpha_warning)
            return
    if image.base_type == 1:
        image_mode = 'Greyscale'
        if layer.bpp != 2:
            gimp.message(no_alpha_warning)
            return
    if image.base_type == 2:
        image_mode = 'Indexed'
        if layer.bpp != 2:
            gimp.message(no_alpha_warning)
            return

    tile_width = gimp.tile_width()
    tile_height = gimp.tile_height()
    layer_copy = layer.copy()
    image.add_layer(layer_copy)

    # Context setters for pdb.gimp_image_select_contiguous_color()
    pdb.gimp_context_set_antialias(0)
    pdb.gimp_context_set_feather(0)
    pdb.gimp_context_set_sample_merged(0)
    pdb.gimp_context_set_sample_criterion(0)
    pdb.gimp_context_set_sample_threshold(1)
    pdb.gimp_context_set_sample_transparent(0)

    # Counters for objects in layer groups
    counter_good = 1
    counter_bad = 1

    # Tile rows and columns of layer_copy
    tile_rows = int( (layer_copy.height + tile_height - 1) / tile_height)
    tile_cols = int( (layer_copy.width  + tile_width - 1) / tile_width)

    # create an 'off-screen' copy of layer_copy (not added to the canvas)
    layer_offscreen = layer_copy.copy()

    # Loop over tiles of layer_offscreen
    for tile_row in range(tile_rows):
        for tile_col in range(tile_cols):
            Tile = layer_offscreen.get_tile(False, tile_row, tile_col)

            # Loop over pixels of tiles
            for tile_y in range(0, Tile.eheight, sample):
                for tile_x in range(0, Tile.ewidth, sample):
                    pixel = Tile[tile_x, tile_y]

                    # Split components of imag_mode to get the alpha
                    # RGBA image
                    if image_mode == 'RGB':
                        R,G,B,A = Tile[tile_x, tile_y]
                    # Greyscale or Indexed image
                    if image_mode == 'Greyscale' or image_mode == 'Indexed':
                        I,A = Tile[tile_x, tile_y]

                    # If pixel is not completely transparent select it and neighbouring non-transparent pixels
                    if ord( A ) > 0:
                        layer_pixel_pos_x = tile_col * tile_height + tile_x
                        layer_pixel_pos_y = tile_row * tile_width + tile_y
                        pdb.gimp_image_select_contiguous_color(image, 2, layer_copy, layer_pixel_pos_x, layer_pixel_pos_y)

                        # Create a layer for an object and assign it to 'small objects' layer group or
                        # 'objects layer group' based on criteria "min_dimensions"
                        object_layer = layer_copy.copy()
                        x1, y1, x2, y2 = layer_copy.mask_bounds

                        # 'small objects' layer group
                        if x2 - x1 < minimal_dimensions and y2 - y1 < minimal_dimensions:
                            if counter_bad == 1 and (image_mode == 'RGB' or image_mode == 'Greyscale'):
                                layer_group_bad = pdb.gimp_layer_group_new(image)
                                layer_group_bad.name = 'small objects'
                                image.add_layer(layer_group_bad)
                            object_layer.name = "trash {:04d} ({:d}, {:d}, {:d}, {:d})".format(counter_bad, x1, y1, x2 - x1, y2 - y1)
                            counter_bad += 1
                            if image_mode == 'RGB' or image_mode == 'Greyscale':
                                image.active_layer = layer_group_bad
                            # Add object to layer_group_bad at the last position
                            pdb.gimp_image_insert_layer(image, object_layer, layer_group_bad, len(layer_group_bad.layers))

                        # 'objects' layer group
                        else:
                            if counter_good == 1 and (image_mode == 'RGB' or image_mode == 'Greyscale'):
                                layer_group_good = pdb.gimp_layer_group_new(image)
                                layer_group_good.name = 'objects'
                                image.add_layer(layer_group_good)
                            object_layer.name = "object {:04d} ({:d}, {:d}, {:d}, {:d})".format(counter_good, x1, y1, x2 - x1, y2 - y1)
                            counter_good += 1
                            if image_mode == 'RGB' or image_mode == 'Greyscale':
                                image.active_layer = layer_group_good
                            # Add object to layer_group_good at the last position
                            pdb.gimp_image_insert_layer(image, object_layer, layer_group_good, len(layer_group_good.layers))


                        # Add object to active layer which is one of the two layer groups
                        #image.add_layer(object_layer)
                        # "Auto crop" object layer
                        object_layer.resize(x2 - x1, y2 - y1, -x1, -y1)

                        # Remove/erase selection from layer_copy
                        image.active_layer = layer_copy
                        pdb.gimp_edit_clear(layer_copy)

                        # Update tile, by updating layer_offscreen, by copying layer_copy
                        layer_offscreen = layer_copy.copy()
                        Tile = layer_offscreen.get_tile(False, tile_row, tile_col)

    # Remove layer_copy and layer_offscreen from canvas and memory
    image.remove_layer(layer_copy)
    del(layer_offscreen)

    # Reset context settings to their default values.
    pdb.gimp_context_set_defaults()

    # End timer and display number of objects, small objects and timer seconds up to milliseconds in error console
    time_end = time.time()
    gimp.message('INFO:\n-{:d} objects found\n'.format(counter_good - 1) +
                 '-{:d} small objects found\n'.format(counter_bad - 1) +
                 '-time taken: {:.3f} seconds'.format(time_end - time_start))

### Parameters
imageParm  = (PF_IMAGE   , "image"             , "Input image"           , None)
layerParm  = (PF_DRAWABLE, "layer"             , "Input layer"           , None)
sampleParm = (PF_INT     , "sample"            , "Sample every nth pixel", 1   )
mindimParm = (PF_INT     , "minimal_dimensions", "Minimal dimension"     , 10  )

### Registrations
name       = "mich-sprites-2-layers"
blurb      = "Objects to layers"
help       = "Separates objects on one layer to their own layer. Handy for Spritesheets"
author     = "Mich"
copyright  = "Mich"
date       = "2018-01-28"
menu_item  = "sprites2layers..."
imagetypes = "*"
params     = [imageParm, layerParm, sampleParm, mindimParm]
results    = []
function   = sprites2layers
menupath   = "<Image>/Layer"

### Registrations
register(
    name      ,
    blurb     ,
    help      ,
    author    ,
    copyright ,
    date      ,
    menu_item ,
    imagetypes,
    params    ,
    results   ,
    function  ,
    menupath
)

main()


I've hit a snag with lines 65 and 129 with "Tile = layer_offscreen.get_tile(False, tile_row, tile_col)". 
in Gimp 3 "drawable.get_tile()" doesn't exist, what is the alternative to this?

Print this item

  Keep exif-orientation on import
Posted by: Pflichtfeld - 03-24-2025, 10:44 PM - Forum: General questions - Replies (9)

Hi guys,
Problem: upright picture (portrait) of a door. Exif in original jpg is right,top.
I send it to gimp. The door now is shown in landscape, the exif now is changed to top,left.
I'm not sure, but maybe once there was a popup how to threat orientation of origin.
But now this popup is gone and I cannot find the option to change this behaviour.
Any help?

Print this item

  menurc file problem with Gimp 3
Posted by: migf1 - 03-24-2025, 06:04 PM - Forum: Gimp 2.99 & Gimp 3.0 - Replies (1)

Hey all,

I tried on Reddit yesterday but no-one replied, I hope someone can help here.

When I installed Gimp 3.0.1 along side my existing Gimp 2 installation on Windows 10, the Gimp 3 installer picked up all*rc files from my Gimp 2 installation, however when I deleted the menurc file from Gimp 3's path (a.k.a "C:\Users\...\Appdata\Roaming\Gimp\3.0") not only the keyboard shortcuts were not reset, but also the menurc file was not recreated in the above path (as it does in Gimp 2). I even tried copying another menurc file of mine, with different keyboard shortcuts, but Gimp 3 fails to read it.

In short, i'm stuck with the custom keyboard shortcuts I had in Gimp 2, and I cannot reset them in Gimp 3. Also, I'm not able to use any menurc file (I have a couple of them with different sets of custom keyboard shortcuts).

Is there any kind of cache file I need to delete or something? Is there any other path I need to look at, where Gimp 3 picks up the old menurc file from? How come it does not recreate the menurc file when I delete it?

Btw, the controllerrc file works fine (it gets recreated when I delete it, I can copy there other versions of it and Gimp 3 loads it, etc). Is there a bug specifically for the menurc file in Gimp 3?

Thanks in advance.

Print this item

  resynthesizer 3.0
Posted by: denzjos - 03-24-2025, 05:24 PM - Forum: Gimp 2.99 & Gimp 3.0 - Replies (8)

I download resynthesizer 3.0 and put the script files in the GIMP 3.0 script folder and the exe file in the GIMP plugin folder. I am using GIMP 3.0.0-1 and find Resynthesizer in the menu, so GIMP finds it. When I try to use Resynthesizer, I get the menu, but when I activate the plugin, I get an error, and the plugin stops. Is the plugin ready for GIMP 3.0.0-1?

Print this item

  GIMP Foreground (or Background) Color Select
Posted by: oyearian - 03-24-2025, 03:31 PM - Forum: Gimp 2.99 & Gimp 3.0 - No Replies

In GIMP 3.0.0 (Mac OS 13.7.4 Ventura) clicking on a color in the "Change Foreground Color" dialog immediately causes the dialog window to disappear. The color is changed, yes, but it seems you have to do it incrementally, step by step, rather than making all the guesstimate changes and then clicking "Okay" as it was in 2.10. I hope that this is a bug rather than a feature. I hope even more that I've simply overlooked a setting somewhere.

Print this item

  Text Layer Edit Disappointment
Posted by: oyearian - 03-24-2025, 12:32 PM - Forum: OSX - Replies (1)

The option to inset symbol or emoji under the Edit menu is gone. It's a relatively minor thing, perhaps, but I wish I still had it. Why take options away with the new version (3.0.0, in my case)?

Print this item

  Print A6 data cards from pdf file
Posted by: Jase - 03-24-2025, 12:16 PM - Forum: General questions - Replies (3)

Hi
I was hoping someone could help me.
I am trying to import a Warhammer 40k kill team data card download as an pdf and simply print it out on size A6 paper.
I would also like to create a template for future data cards.
I have tried simply changing the printer properties in gimp and the printer to match but I keep getting a paper size error (E1) on my HP printer.
I am new to Gimp.

Any help would be appreciated

Print this item

  Converting python plugin-in shellout.py from gimp 2.x to 3.x
Posted by: iiey - 03-24-2025, 08:34 AM - Forum: Gimp 2.99 & Gimp 3.0 - Replies (53)

Dear Gimp developers,

Background: the shellout.py (7 years old script) is an approach for calling NikCollection Filters and using the result in GIMP. It still worked with win10 & win11 until GIMP 3.x.

I’m having trouble converting the Python plug-in script from GIMP 2.x to 3.x.
Thank @Ofnuts for pointing out the helloworld plugin example, that helped me understand the basics a little bit.

Currently, I’m stuck on adapting the part that opens a popup-menu with RATIO and OPTION (see youtube video) choices within the register() function (v2.x).

Here is the code snippet which can show ShellOut in menu Filters/ but still missing the functionality, I took a look in v3.0 API but got confuse..:

Code:
def plugin_main(procedure, run_mode, image, n_drawables, drawables, config, data):
 ...

class ShellOut(Gimp.PlugIn):

  def do_query_procedures(self):
      return [PROC_NAME]

  def do_create_procedure(self, name):
      procedure = Gimp.ImageProcedure.new(self, name,
                                         Gimp.PDBProcType.PLUGIN,
                                         plugin_main, None)
     
      procedure.set_image_types("RGB*, GRAY*")
      procedure.set_menu_label("ShellOut...")
      procedure.set_attribution(AUTHOR, COPYRIGHT, DATE)
      procedure.set_documentation(HELP, DOC, None)

      procedure.add_menu_path("<Image>/Filters/ShellOut...")

      # FIXME: How to open menu and get return values and pass into main_plugin()?
     
      return procedure

Gimp.main(ShellOut.__gtype__, sys.argv)

Could someone give me the concrete instructions how rewrite the script to make it work again in GIMP 3.x?
Thank you very much for your help!

Best regards,

PS: Attached is the 'in-progress' reworked version for v3.x in comparison to the original 2.x script could be found in the link above.



Attached Files
.txt   shellout_v3.txt (Size: 8 KB / Downloads: 80)
Print this item

  Need help removing background!!
Posted by: rdoty - 03-24-2025, 02:44 AM - Forum: General questions - Replies (8)

I've been fighting this for days now and I need help.  What I thinki should be a simple process is absolutely baffeling.  I have a number of color .jpeg images  and no matter what method I use, fuzzy select (sort of worked but too much edge pixels}, color select, path select, I can't get it to work.  Out of desparation I upgraded from ver 2.1 to 3.0 and still no result.  I finally resorted to picking a no-brainer eazy peazy image, shades of grey, simple shape and still can't get it to work. 
   Although it's going to take a lot more time I think  I've decided to do the path select method.  The problem is that when the path is complete and, following all the directions from tutorials and posted online, I right click and select Select/Selection from paths then delete nothing happens.  I've closed the view and started over several times and zilch.  I'll attach a copy of the image (mug clip2.jpeg).  Somewhere along the way either I'm missing something or maybe there's a glitch in my Gimp.   I appreciate any help.



Attached Files Image(s)
   
Print this item