Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 4,619
» Latest member: Jānis
» Forum threads: 7,481
» Forum posts: 40,852
Full Statistics
|
|
|
Color is not translating correctly |
Posted by: Mfrench4712 - 3 hours ago - Forum: General questions
- No Replies
|
 |
New user to Gimp. So if there is something more I need to provide, let me know.
Gimp Version: 3.0.4
OS: Windows 10
Attempting to use the Color/Hue Saturation feature to isolate one color in the picture but the colors are not translating correctly.
Original file was in RAW format
Was converted using RAW Therapee 5.11
Not sure if I selected the correct options, but the yellow changes to black when using the color/hue saturation option
See attached screenshot file
Thank you,
Margaret
|
|
|
Endianess of pixel data in a Python region for gimp 2.10. |
Posted by: teapot - 4 hours ago - Forum: Scripting questions
- Replies (3)
|
 |
For gimp 2.10, is my understanding correct?
Given a region's bytes from a layer ‘l’:
r = l.get_pixel_rgn(0, 0, w, h)
rb = r[:, :]
I think rb will hold the bytes of the channel's values in the machine's native endianess because:
- a region maps onto tiles,
- getting the tile's pixels uses a simple memcpy(), and
- a tile's pixels are in the native endianess.
I'm aware tile data in an XCF file is big-endian from
https://testing.developer.gimp.org/core/...ganization
But I'm interested in what's in memory and guaranteed to be seen through slicing a Python region into a string of bytes.
|
|
|
3.0.4 crashes all the time? |
Posted by: mayorpunk - Yesterday, 11:13 PM - Forum: Gimp 2.99 & Gimp 3.0
- No Replies
|
 |
Hello! First time posting. Just started using GIMP again and downloaded the latest version, 3.0.4. It keeps crashing on me? All i'm doing is paning, zooming, and erasing, pretty simple stuff. This is the error I get, I have no idea how to interpret this:
GNU Image Manipulation Program version 3.0.4
git-describe: GIMP_3_0_4
Build: org.gimp.GIMP_official rev 0 for windows
# C compiler #
clang version 20.1.5
Target: x86_64-w64-windows-gnu
Thread model: posix
InstalledDir: C:/msys64/clang64/bin
# Libraries #
using babl version 0.1.114 (compiled against version 0.1.114)
using GEGL version 0.4.62 (compiled against version 0.4.62)
using GLib version 2.84.1 (compiled against version 2.84.1)
using GdkPixbuf version 2.42.12 (compiled against version 2.42.12)
using GTK+ version 3.24.49 (compiled against version 3.24.49)
using Pango version 1.56.3 (compiled against version 1.56.3)
using Fontconfig version 2.16.2 (compiled against version 2.16.2)
using Cairo version 1.18.4 (compiled against version 1.18.4)
using gexiv2 version 0.14.3 (compiled against version 0.14.3)
using exiv2 version 0.28.5
> fatal error: unhandled exception
Stack trace:
-------------------
Error occurred on Sunday, July 13, 2025 at 19:05:50.
gimp-3.exe caused an Access Violation at location 00007FF622808C78 in module gimp-3.exe Reading from location 0000000000000008.
|
|
|
cannot find instructions for converting .svg to .ggr |
Posted by: Logansfury - Yesterday, 11:04 PM - Forum: General questions
- Replies (4)
|
 |
Hello,
Some time ago, I found an inkscape file of metal graidents. I used boxySVG on linux to separate them into individual .svg files, then, somehow, I got all these .svg files converted in GIMP 2.10 into .ggr files.
I have been all over the net for hours, I cannot find the instructions I followed to convert these .svg files. Can anyone please help?
|
|
|
Edge detect leaves invisible layers |
Posted by: marty39 - Yesterday, 09:34 PM - Forum: Gimp 2.99 & Gimp 3.0
- Replies (3)
|
 |
I'm using Gimp 3.04 in macOS. I have a color photo, I desaturate and apply one of the edge-detect filters. The edges come out white on dark, I want black edges on a light background, so I invert colors. I still have white edges on a dark background but they have moved a little. It acts like there is more than one layer and I'm only inverting one of them. So I apply flatten image, and then color invert. Now I get the expected result, dark edges on a light background.
This happens with all the different edge detect filters. It did not happen in Gimp 2.x. Something changed and I want it fixed. Preferably merge those layers, as apparently happened in Gimp 2.x, or at least show the layers in the layers panel.
|
|
|
Blur/Sharp tool |
Posted by: AWysy - 07-10-2025, 04:59 PM - Forum: General questions
- Replies (5)
|
 |
Hi,
Just started to use GIMP. I am making my first experiences.
I have one question concerning Blur/Sharpen tool. After blurring and switching to sharpening the blurred part does not "return" to the original by applying the sharpen too. However after the sharpening, blurring functions. Is this normal, or some of the settings need to be changed.?
Thank you
|
|
|
script not available |
Posted by: Zydelum - 07-10-2025, 04:33 PM - Forum: Extending the GIMP
- No Replies
|
 |
Hi,
Code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import gi
gi.require_version('Gimp', '3.0')
from gi.repository import Gimp
gi.require_version('GimpUi', '3.0')
from gi.repository import GimpUi
gi.require_version('Gegl', '0.4') # Gegl est utilisé pour les opérations de bas niveau sur les pixels
from gi.repository import Gegl
from gi.repository import GObject
from gi.repository import GLib
import sys
import math # Pour la fonction sqrt (racine carrée) dans le calcul de la différence de couleur
# Fonctions de traduction (standard pour les plugins GIMP)
def N_(message): return message
def _(message): return GLib.dgettext(None, message)
class CleanAndRegularize (Gimp.PlugIn):
## GimpPlugIn virtual methods ##
# Cette méthode est appelée par GIMP au démarrage pour savoir quels plugins sont disponibles
def do_query_procedures(self):
# Retourne une liste des noms de procédures que ce plugin fournit
return [ "plug-in-clean-and-regularize" ]
# Cette méthode est appelée pour créer une instance de la procédure
def do_create_procedure(self, name):
# Crée une nouvelle procédure d'image
procedure = Gimp.ImageProcedure.new(self, name,
Gimp.PDBProcType.PLUGIN,
self.run, None)
# Définit les types d'images sur lesquels le plugin peut opérer
procedure.set_image_types("*") # Peut opérer sur n'importe quel type d'image
# Définit la sensibilité du plugin (nécessite un calque sélectionné)
procedure.set_sensitivity_mask(Gimp.ProcedureSensitivityMask.DRAWABLE)
# Définit le texte qui apparaîtra dans le menu GIMP
procedure.set_menu_label(_("Nettoyer et Régulariser..."))
# Définit le chemin dans le menu GIMP
procedure.add_menu_path('<Image>/Filters/Ma_Regularisation/')
# Ajoute la documentation (visible dans le navigateur de procédures)
procedure.set_documentation(_("Nettoie une image en rendant transparents les pixels en dehors d'une couleur sélectionnée, puis régularise la forme restante."),
_("Rend transparents les pixels en dehors d'une couleur sélectionnée et régularise la forme restante."),
name)
# Attribution de l'auteur
procedure.set_attribution("Votre Nom", "Votre Nom", "2025")
# Ajoute les paramètres de la procédure (ceux qui apparaissent dans la boîte de dialogue)
procedure.add_argument_from_property(GObject.Property(
"target-color", "Couleur à conserver",
"La couleur cible à conserver dans l'image.",
GObject.TYPE_JSUINT64, # Type de propriété pour la couleur (RGBA 64 bits)
Gimp.RGB(255, 255, 255).to_rgba(), # Valeur par défaut (blanc)
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY
))
procedure.add_argument_from_property(GObject.Property(
"tolerance", "Tolérance de couleur (0-255)",
"La tolérance pour la comparaison des couleurs (0-255).",
GObject.TYPE_INT, # Type entier
30, # Valeur par défaut
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
minimum=0, maximum=255
))
procedure.add_argument_from_property(GObject.Property(
"operation-type", "Opération de régularisation",
"Le type d'opération de régularisation à appliquer.",
GObject.TYPE_INT, # Type entier pour l'option
0, # Valeur par défaut (0 = Aucune)
GObject.ParamFlags.READWRITE | GObject.ParamFlags.CONSTRUCT_ONLY,
# Les options sont définies par des paires valeur/label
blurb_values=["Aucune", "Érosion de la sélection", "Dilatation de la sélection"]
))
return procedure
# La méthode 'run' est le cœur du plugin, exécutée lorsque l'utilisateur lance le plugin
def run(self, procedure, run_mode, image, drawables, config, run_data):
# Vérifie qu'un seul calque est sélectionné
if len(drawables) != 1:
msg = _("Procedure '{}' only works with one drawable.").format(procedure.get_name())
error = GLib.Error.new_literal(Gimp.PlugIn.error_quark(), msg, 0)
return procedure.new_return_values(Gimp.PDBStatusType.CALLING_ERROR, error)
else:
drawable = drawables[0]
# Récupère les valeurs des paramètres de la configuration
target_color_rgba = config.get_property("target-color")
# Convertit la couleur RGBA 64 bits en Gimp.RGB pour un accès facile
target_color_gimp_rgb = Gimp.RGB()
target_color_gimp_rgb.parse_rgba(target_color_rgba)
target_r = target_color_gimp_rgb.red_int
target_g = target_color_gimp_rgb.green_int
target_b = target_color_gimp_rgb.blue_int
tolerance = config.get_property("tolerance")
operation_type = config.get_property("operation-type")
# Début de l'opération GIMP (pour l'historique d'annulation)
image.undo_group_start()
Gimp.progress_init(_("Traitement de l'image..."))
# Assurez-vous que le calque a un canal alpha pour la transparence
if not drawable.has_alpha():
drawable.add_alpha()
# --- Étape 1 : Rendre transparent les pixels hors couleur cible ---
width = drawable.get_width()
height = drawable.get_height()
# Utilisation de Gegl.Buffer pour un accès aux pixels plus performant et moderne
# Obtient le buffer du calque (le contenu des pixels)
buffer = drawable.get_buffer()
# Crée un buffer d'ombre pour les modifications (meilleure pratique pour les plugins)
shadow_buffer = drawable.get_shadow_buffer()
# Accès direct aux pixels via Gegl.Buffer.get_pixel() et Gegl.Buffer.set_pixel()
# C'est plus lent que les opérations GEGL natives, mais plus simple pour ce type de logique
# Pour des performances extrêmes sur de très grandes images, il faudrait utiliser des opérations GEGL complètes.
for y in range(height):
Gimp.progress_update(float(y) / height) # Met à jour la barre de progression
for x in range(width):
# Récupère le pixel du buffer original
pixel_data = buffer.get_pixel(x, y)
# Les données de pixel sont un tuple (r, g, b, a) où chaque composante est un float de 0.0 à 1.0
r, g, b, a = pixel_data[0], pixel_data[1], pixel_data[2], pixel_data[3]
# Convertit les floats (0.0-1.0) en entiers (0-255) pour la comparaison de tolérance
current_r = int(r * 255)
current_g = int(g * 255)
current_b = int(b * 255)
# Calculer la différence de couleur (distance euclidienne)
diff = math.sqrt((current_r - target_r)**2 + (current_g - target_g)**2 + (current_b - target_b)**2)
if diff > tolerance:
# Rendre le pixel transparent (alpha = 0.0)
shadow_buffer.set_pixel(x, y, (r, g, b, 0.0))
else:
# Conserver le pixel tel quel
shadow_buffer.set_pixel(x, y, (r, g, b, a))
# Applique les modifications du buffer d'ombre au calque
drawable.merge_shadow(True)
# Met à jour la zone modifiée pour l'affichage
drawable.update(0, 0, width, height)
# --- Étape 2 : Régulariser la forme restante ---
# Utilisation des fonctions PDB de GIMP pour les opérations de sélection et de remplissage
if operation_type == 1: # Érosion de la sélection
# Crée une sélection à partir du canal alpha du calque
image.set_selection_mask(drawable.get_alpha_mask())
# Rétrécit la sélection
Gimp.selection_shrink(image, 2) # Rétrécir de 2 pixels
# Inverse la sélection pour remplir l'extérieur
image.invert_selection()
# Remplir la sélection inversée avec de la transparence
drawable.fill(Gimp.FillType.TRANSPARENT)
# Désélectionne tout
image.set_selection_mask(None)
elif operation_type == 2: # Dilatation de la sélection
image.set_selection_mask(drawable.get_alpha_mask())
# Agrandit la sélection
Gimp.selection_grow(image, 2) # Agrandir de 2 pixels
image.invert_selection()
drawable.fill(Gimp.FillType.TRANSPARENT)
image.set_selection_mask(None)
# Rafraîchir l'affichage de toutes les fenêtres GIMP
Gimp.displays_flush()
image.undo_group_end() # Fin de l'opération GIMP (pour l'historique d'annulation)
Gimp.progress_end()
# Retourne les valeurs de succès
return procedure.new_return_values(Gimp.PDBStatusType.SUCCESS, GLib.Error())
# Enregistre le plugin dans GIMP
Gimp.main(CleanAndRegularize.__gtype__, sys.argv)
Here's a Python script that's supposed to:
- select a color from an image
- make other colors transparent except for very similar ones
- smooth (delete, add pixels) in the remaining areas so that the angles are sharp in detail
I placed this script in a folder with the same name, but the Gimp3 console returns some errors
Can you fix this script?
thanks
|
|
|
|