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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,741
» Latest member: Leopardo-40
» Forum threads: 7,234
» Forum posts: 39,479

Full Statistics

Latest Threads
Is your 3.0 Python runnin...
Forum: Gimp 2.99 & Gimp 3.0
Last Post: sallyanne
52 minutes ago
» Replies: 1
» Views: 46
ofn3-align-layers
Forum: Extending the GIMP
Last Post: zxc_jk5050
1 hour ago
» Replies: 8
» Views: 851
How would you do a weathe...
Forum: General questions
Last Post: rich2005
8 hours ago
» Replies: 1
» Views: 60
Gimp 3.0 print menu missi...
Forum: Gimp 2.99 & Gimp 3.0
Last Post: Photomar2025
10 hours ago
» Replies: 3
» Views: 150
GIMP 3.0 is here!
Forum: Gimp 2.99 & Gimp 3.0
Last Post: charlie84
Yesterday, 01:36 PM
» Replies: 0
» Views: 81
Artbox
Forum: Alternate Gimp packagings
Last Post: pixelmixer
Yesterday, 11:34 AM
» Replies: 3
» Views: 181
Gimp 3.x scanner xsane pl...
Forum: Gimp 2.99 & Gimp 3.0
Last Post: henry88g
Yesterday, 10:03 AM
» Replies: 3
» Views: 1,248
transform tools in action
Forum: Tutorials and tips
Last Post: denzjos
Yesterday, 09:57 AM
» Replies: 0
» Views: 69
Help with unusual request
Forum: General questions
Last Post: rinaldop
Yesterday, 07:01 AM
» Replies: 3
» Views: 330
Move tool very slow
Forum: General questions
Last Post: Photoniker
03-16-2025, 02:29 AM
» Replies: 2
» Views: 312

 
  scripts for comics trip
Posted by: jacques_duflos - 05-11-2023, 08:11 PM - Forum: Extending the GIMP - Replies (5)

Hi there,
I do comics trip as a hobby. Here are some of my works. I use gimp for text, editing, sometimes coloring or texturing. I will show in this thread the scripts I did to ease some tasks. Comments and advice are welcome

This first script is made to prepare a scanned drawing. automatize de-saturating, changing contrast and light, and separate the ink from the background, so I can add a color layer in between and paint.

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

# GIMP plugin to separe the ink form the paper of a b&w scan
# (c) Jacques Duflos 2023
#
#   History:
#
#   v0.0: 2023-xx-xx: First published version

#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

import sys, os
from gimpfu import *
import gimpcolor
#print "**********preparer un scan***************"
debug= False

def trace(s):
   if debug:
       print "****"
       print s
       print "****"
       



def preparerUnScan(image):
    image.undo_group_start()
    trace("1")
    # récupérer l'image et le calque selectionné
    layer = pdb.gimp_image_get_active_layer(image)
    layer_name = pdb.gimp_item_get_name(layer)
    trace("2  "+ layer_name)
    #désaturer, pousser le contraste très haut et augmenter un peu la luminosité.
    # voir pour en faire des paramètres éventuellement.
    pdb.gimp_drawable_desaturate(layer, 0)
    trace("3")
    pdb.gimp_drawable_brightness_contrast(layer, -0.2, 0.8)
    #enregistrer les variables de contexte avant de les modifier
    opacity_old = pdb.gimp_context_get_opacity()
    foreground_old = pdb.gimp_context_get_foreground()
    paint_mode_old = pdb.gimp_context_get_paint_mode()
    #print foreground_old
    pdb.gimp_context_set_opacity(100)
    pdb.gimp_context_set_foreground(gimpcolor.RGB(1.0, 1.0, 1.0, 1.0))
    pdb.gimp_context_set_paint_mode(LAYER_MODE_COLOR_ERASE)
    
    
    #effacer l'arrière plan blanc
    pdb.gimp_layer_add_alpha(layer)
    pdb.gimp_drawable_edit_fill(layer, FILL_FOREGROUND)
    trace("fond effacé")
    
    #créer le fond blanc
    fond = pdb.gimp_layer_new(image, pdb.gimp_image_width(image), pdb.gimp_image_height(image), RGB_IMAGE , "fond", 100, LAYER_MODE_NORMAL)
    num_layers, layer_ids = pdb.gimp_image_get_layers(image)
    pdb.gimp_image_add_layer(image, fond, num_layers)
    pdb.gimp_context_set_paint_mode(LAYER_MODE_NORMAL )
    pdb.gimp_drawable_edit_fill(fond, FILL_FOREGROUND)
    
    #rétablir les variables
    pdb.gimp_context_set_opacity(opacity_old)
    pdb.gimp_context_set_foreground(foreground_old)
    pdb.gimp_context_set_paint_mode(paint_mode_old)
    trace("contexte rétabli")
    
    image.undo_group_end()
    

### Registrations
whoiam='\n'+os.path.abspath(sys.argv[0])

register(
   'preparer-un-scan',
   'Prépare un scan %s' % whoiam,
   'prépare un scan',
   'Jacques Duflos','Jacques Duflos','2023',
   'Prépare un scan...',
   '*',
   [
       (PF_IMAGE,  'image',            'Image', None)
   ],
   [],
   preparerUnScan,
   menu='<Image>/Layer'
)

main()


This second script is made to move all the text layers in a layer group named texts.

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

# GIMP plugin to move every text layer in a text layer group
# (c) Jacques Duflos 2023
#
#   History:
#
#   v0.0: 2023-xx-xx: First published version

#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

import sys, os
from gimpfu import *
import gimpcolor
print "**********calques texte dans groupe***************"
debug= True

def trace(s):
   if debug:
       print "**** "
       print s
       print "**** "
       
def calquesTextesDansGroupe(image):
    image.undo_group_start()
    trace("1")
    groupe_textes = pdb.gimp_layer_group_new(image)
    pdb.gimp_item_set_name(groupe_textes, "textes")
    pdb.gimp_image_insert_layer(image, groupe_textes, None, 0)
    calques=[]
    for numero_calque in range(pdb.gimp_image_get_layers(image)[0]):
        calques.append(image.layers[numero_calque])
    
    trace(calques)
    for calque in calques :
        if pdb.gimp_item_is_text_layer(calque):
            pdb.gimp_image_reorder_item(image, calque, groupe_textes, 0)
    
    image.undo_group_end()
    

### Registrations
whoiam='\n'+os.path.abspath(sys.argv[0])

register(
   'textes-dans-groupe',
   'Mettre les calques textes dans un groupe %s' % whoiam,
   'Mettre les calques textes dans un groupe',
   'Jacques Duflos','Jacques Duflos','2023',
   'Mettre les calques textes dans un groupe...',
   '*',
   [
       (PF_IMAGE,  'image',            'Image', None)
   ],
   [],
   calquesTextesDansGroupe,
   menu='<Image>/Layer'
)

main()

Im presently working on a script that makes a text bubble around a text layer.
enjoy !

Print this item

Photo Increase background walls darker
Posted by: integrator - 05-11-2023, 06:01 PM - Forum: General questions - Replies (1)

Hello,

I have a .png of a floor plan which I need to darken the walls etc. I've tried couple things without luck so I'm looking for sugesstions. The picture is attached.

Thanks for any support on this.



Attached Files Thumbnail(s)
   
Print this item

  Issues trying to Compose an image with masked channels
Posted by: pronay - 05-10-2023, 10:34 PM - Forum: Scripting questions - Replies (5)

Hello,

This is my first time trying to write a Python script in GIMP so I am still learning my way around this stuff.
I am trying to implement a script by which I can perform the following steps:

1. Decompose an Image into RGBA channels (Colors->Components->Decompose->Color Model: RGBA)
2. Recompose an Image using R,G channels with B and A using Mask Value of 255 (Colors->Components->Compose->Color Model: RGBA, B and A use 255 mask value)

To do this in Python, I am attempting the following steps:

Code:
       decomposed = pdb.plug_in_decompose(img, drawable, "RGBA", 0)
   
       gimp.message("Performed Decompose")

       # Grab the name of the original image
       fileNameWithExt = pdb.gimp_item_get_name(draw)
       fileNameNoExt = fileNameWithExt.split('.')

       # Create the layers
       gimp.message("Creating new Layers")
       gimp.message("Setting up Red Layer")
       layerR = pdb.gimp_layer_new_from_drawable(pdb.gimp_image_get_active_layer(decomposed[0]), decomposed[0])
       layerName = fileNameNoExt[0] + "_RGBA_Red"
       pdb.gimp_item_set_name(layerR, layerName)
       pdb.gimp_image_insert_layer(decomposed[0], layerR, None, 0)

       gimp.message("Setting up Green Layer")
       layerG = pdb.gimp_layer_new_from_drawable(pdb.gimp_image_get_active_layer(decomposed[1]), decomposed[1])
       layerName = fileNameNoExt[0] + "_RGBA_Green"
       pdb.gimp_item_set_name(layerG, layerName)
       pdb.gimp_image_insert_layer(decomposed[1], layerG, None, 1)

       gimp.message("Setting up Blue Layer")
       layerB = pdb.gimp_layer_new_from_drawable(pdb.gimp_image_get_active_layer(decomposed[2]), decomposed[2])
       layerName = fileNameNoExt[0] + "_RGBA_Blue"
       pdb.gimp_item_set_name(layerB, layerName)
       pdb.gimp_image_insert_layer(decomposed[2], layerB, None, 2)

       gimp.message("Setting up Alpha Layer")
       layerA = pdb.gimp_layer_new_from_drawable(pdb.gimp_image_get_active_layer(decomposed[3]), decomposed[3])
       layerName = fileNameNoExt[0] + "_RGBA_Alpha"
       pdb.gimp_item_set_name(layerA, layerName)
       pdb.gimp_image_insert_layer(decomposed[3], layerA, None, 3)
   
       gimp.message("Creating Layer Mask")
       channelB = pdb.gimp_layer_create_mask(layerB, 1)
       channelA = pdb.gimp_layer_create_mask(layerA, 1)

       gimp.message("Inserting Channels to Decomposed Images")
       pdb.gimp_image_insert_channel(decomposed[2], channelB, None, 0)
       pdb.gimp_image_insert_channel(decomposed[3], channelA, None, 0)

       # Now compose the new image into the target export image
       gimp.message("Starting Compose Step for Output")
       OutImage = pdb.plug_in_compose(decomposed[0], draw, decomposed[1], decomposed[2], decomposed[3], "RGBA")
       gimp.message("Done with Composing Output")

However, when I run this script, I see that my output image is the exact same as the input. This means that the 255 masks are not being applied to the output composed image.
Is the approach I am using correct here? How should I be applying the 255 Mask Value to the B and A channels similar to the settings available for the Compose option in the UI?

Any advice here would be much appreciated.

Print this item

  I'm upset and proud, but I also feel that I'm quite outdated now
Posted by: PixLab - 05-10-2023, 06:58 AM - Forum: Watercooler - Replies (2)

My youngest son got this subject for home work, (he's 11-years old)

Subject:
   

After less than 5 minutes he shows to mom, a nice 5 paragraphs full A4 page of a nice story, thus my wife called me, very proud of our son, then I started to read... and I discovered than he did use chatGPT ...   Huh

We got 5 minutes with my son, that AI can be useful, but they do a lot of errors and most important for home work > no more AI. Rolleyes
But, jeez that 5 paragraphs story was good Blush

Print this item

  tilemaps
Posted by: retroarchgirl - 05-10-2023, 03:50 AM - Forum: Extending the GIMP - Replies (1)

Hi GIMPies!

I'm very new to make tilemaps.
I installed this plugin

https://github.com/bbbbbr/gimp-tilemap-gb

Anybody who wants to install it and explain me the workflow?
I have a bit difficulties to understand since there is docs Blush

Print this item

  Colors not changing automatically
Posted by: Estes0171 - 05-09-2023, 06:33 PM - Forum: General questions - Replies (1)

   
Up until last night when I would go and select colorize or any of the color option it would change colors as I selected the color or slid the sliding bar to desired look the hit ok. Now when I do any of those actions the colors don't change until I hit ok which makes it hard to get the color I'm looking for unless I make multiple attempts so did I somehow click something to cause this or is there some type of bug? it does it on all images and I have uninstalled and reinstalled Gimp to see if it fixes the issues and stil does it/

Print this item

  no dds option in batch
Posted by: y2keeth - 05-09-2023, 07:29 AM - Forum: General questions - Replies (2)

was there  not now
https://pasteboard.co/DA6SvKGR9dc1.png
should have posted here first sorry about the issue

Print this item

  cyan : for prepress work
Posted by: denzjos - 05-08-2023, 06:47 PM - Forum: Other graphics software - Replies (1)

https://cyan.graphics
Cyan is an open source cross-platform image viewer and converter, designed for prepress (print) work. Like converting an image from RGB to CMYK, or the other way around. Cyan supports color profiles complying with the International Color Consortium (ICC) standard, and strives to create as color-accurate images as possible, with support for RGBCMYK and GRAY.
   

Print this item

  installing brushes
Posted by: retroarchgirl - 05-08-2023, 12:18 AM - Forum: Extending the GIMP - Replies (1)

Hi GIMPies!

I try to install these brushes but even with the instructions, I don't know what to do.
So you need to open the 3 folders and then ...what to do? Blush
I have the folders found here.

https://github.com/SenlinOS/SLOS-GIMPainter

Print this item

  pixelate image
Posted by: retroarchgirl - 05-08-2023, 12:10 AM - Forum: General questions - Replies (1)

Hi GIMPies!

I'm trying to find out if there is a sequence of tools inside gimp you can use to 'pixelate' an image as seen here.
I want to do it on an entire image and be able to set the pixel size.

https://onlineimagetools.com/pixelate-image

Or maybe a plugin/script?

Print this item