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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 4,362
» Latest member: CfsZow
» Forum threads: 6,666
» Forum posts: 36,332

Full Statistics

Latest Threads
3D like effect on frames ...
Forum: General questions
Last Post: sallyanne
13 minutes ago
» Replies: 3
» Views: 91
User Experience
Forum: Watercooler
Last Post: CfsZow
1 hour ago
» Replies: 6
» Views: 4,570
Pseudo-infrared
Forum: Tutorials and tips
Last Post: CfsZow
3 hours ago
» Replies: 3
» Views: 1,446
QR
Forum: Other graphics software
Last Post: CfsZow
6 hours ago
» Replies: 6
» Views: 3,662
Gimp UI progress bar "can...
Forum: Scripting questions
Last Post: JBreckeen
Yesterday, 05:22 PM
» Replies: 2
» Views: 82
Automatic cutting image i...
Forum: General questions
Last Post: rinaldop
Yesterday, 02:39 PM
» Replies: 6
» Views: 139
Downloaded the full gimps...
Forum: Watercooler
Last Post: vitforlinux
Yesterday, 11:49 AM
» Replies: 4
» Views: 262
Some folders missing icon...
Forum: General questions
Last Post: dclement
Yesterday, 10:05 AM
» Replies: 0
» Views: 49
Currently Active Image
Forum: Scripting questions
Last Post: JBreckeen
05-05-2024, 07:30 PM
» Replies: 6
» Views: 241
Darktable Images Opening ...
Forum: Windows
Last Post: rich2005
05-05-2024, 05:13 PM
» Replies: 4
» Views: 170

 
  translating every text layer
Posted by: jacques_duflos - 07-12-2023, 11:42 PM - Forum: Scripting questions - Replies (7)

Hi there,
I made this script that translates every text layer of the layer group selected, or the text layer selected.
As you can see  at lines 50 to 54, I had to skip the text layers witches text are None because it generated an error and interrupted the script. But I don't understand why some of my text layers return the None value when I ask them their text. All those text layers have a text. Any clue anyone ?

Code:
               # lines 50 to 54
                # Vérifier si le texte n'est pas de type NoneType
                if text is not None:
                    # Traduire le texte en utilisant la bibliothèque translate
                    translated_text = translator.translate(text)
                else:
                    translated_text = "ERREUR TEXTE NON TRADUIT\n{}".format(text)


Another question I have is about the libraries I had to include. I added them directly next to the .py that needed them and it works. But I guess it is not the elegant way of doing so. If I do another script needing the same libraries, I would have to include them once more. Is there a way to include libraries in the gimp specific python installation ?
the dependencies are as followed :
traducion.py (my script) needs translate
translate.py needs providers
providers/mymemory_translated.py needs requests

the main script is :

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

from gimpfu import *
from translate import Translator

def translate_text_layers(image, drawable):
    image.undo_group_start()
    
    translator = Translator(to_lang="fr", from_lang="es")
    print("------------start--------------")
    pdb.gimp_message_set_handler(MESSAGE_BOX)
    
    # Recuperation du groupe de calques selectionne
    group = pdb.gimp_image_get_active_layer(image)
    
    # Récupération du groupe de calques "text-fr" s'il existe
    group_text = None
    for layer in image.layers:
        if pdb.gimp_item_is_group(layer) and pdb.gimp_item_get_name(layer) == "text-fr":
            group_text = layer
            break

    if group_text is None:
        # Créer un groupe de calques nommé "text-fr" s'il n'existe pas
        group_text = pdb.gimp_layer_group_new(image)
        pdb.gimp_item_set_name(group_text, "text-fr")
        pdb.gimp_image_insert_layer(image, group_text, None, 0)

    if pdb.gimp_item_is_group(group):
        print("----------layer is group-------------")
        # Creer un groupe de calques nommé "text-fr"
        group_text = pdb.gimp_layer_group_new(image)
        pdb.gimp_item_set_name(group_text, "text-fr")
        pdb.gimp_image_insert_layer(image, group_text, None, 0)
        # Parcours de tous les calques du groupe
        for layer in group.layers:
            # Vérification si le calque est de type texte
            if pdb.gimp_item_is_text_layer(layer):
                # Dupliquer le calque
                duplicate = pdb.gimp_layer_copy(layer, True)
                
                # Ajouter le calque duplique au groupe "text-fr"
                pdb.gimp_image_insert_layer(image, duplicate, group_text, 0)
                
                # Récupérer le contenu texte du calque dupliqué
                text = pdb.gimp_text_layer_get_text(duplicate)
                
                # Vérifier si le texte n'est pas de type NoneType
                if text is not None:
                    # Traduire le texte en utilisant la bibliothèque translate
                    translated_text = translator.translate(text)
                else:
                    translated_text = "ERREUR TEXTE NON TRADUIT\n{}".format(text)

                
                # Mettre à jour le texte du calque dupliqué avec la traduction
                pdb.gimp_text_layer_set_text(duplicate, translated_text)

        # Actualisation de l'affichage de l'image
        pdb.gimp_displays_flush()
    elif pdb.gimp_item_is_text_layer(group):
        print("----------layer is text-------------")
        # Si le calque sélectionné est un calque de texte
        # Dupliquer le calque
        duplicate = pdb.gimp_layer_copy(group, True)
        
        # Ajouter le calque duplique au groupe "text-fr"
        pdb.gimp_image_insert_layer(image, duplicate, group_text, 0)
        
        # Récupérer le contenu texte du calque dupliqué
        text = pdb.gimp_text_layer_get_text(duplicate)
        
        # Traduire le texte en utilisant la bibliothèque translate
        translated_text = translator.translate(text)
        
        # Mettre à jour le texte du calque dupliqué avec la traduction
        pdb.gimp_text_layer_set_text(duplicate, translated_text)
    else:
        print("--------Veuillez sélectionner un groupe de calques ou un calque de texte.----")
        gimp.message("Veuillez sélectionner un groupe de calques ou un calque de texte.")
    
    pdb.gimp_message("fini")
    # restore stuff
    image.undo_group_end()

register(
    "python-fu-translate-text-layers",
    "Translate text layers from French to English",
    "Translate text layers from French to English",
    "Your Name",
    "Your Name",
    "2023",
    "<Image>/Filters/Language/Translate Text Layers",
    "*",
    [],
    [],
    translate_text_layers)

main()



Attached Files
.zip   traduction.zip (Size: 470.93 KB / Downloads: 398)
Print this item

  undefined reference to `ILBM_read'
Posted by: jiapei100 - 07-12-2023, 09:39 PM - Forum: Gimp 2.99 & Gimp 3.0 - Replies (3)

Hi, all:

I'm trying to build gimp-2.99.16 under Ubuntu 22.04,  but obtained the following ERROR messages:

Code:
[2192/2522] cc  -o plug-ins/common/file-iff plug-ins/common/file-iff.p/file-iff.c.o -Wl,--as-needed -Wl,--no-undefined '-Wl,-rpath,$ORIGIN/../../libgimp:$ORIGIN/../../libgimpbase:$ORIGIN/../../libgimpcolor:$ORIGIN/../../libgimpconfig:$ORIGIN/../../libgimpmath:$ORIGIN/../../libgimpmodule:$ORIGIN/../../libgimpwidgets' -Wl,-rpath-link,....../gimp/builddir/libgimp -Wl,-rpath-link,....../gimp/builddir/libgimpbase -Wl,-rpath-link,....../gimp/builddir/libgimpcolor -Wl,-rpath-link,....../gimp/builddir/libgimpconfig -Wl,-rpath-link,....../gimp/builddir/libgimpmath -Wl,-rpath-link,....../gimp/builddir/libgimpmodule -Wl,-rpath-link,....../gimp/builddir/libgimpwidgets -Wl,--start-group libgimp/libgimp-3.0.so.0.9900.17 libgimpbase/libgimpbase-3.0.so.0.9900.17 libgimpcolor/libgimpcolor-3.0.so.0.9900.17 libgimpconfig/libgimpconfig-3.0.so.0.9900.17 libgimpmath/libgimpmath-3.0.so.0.9900.17 libgimp/libgimpui-3.0.so.0.9900.17 libgimpwidgets/libgimpwidgets-3.0.so.0.9900.17 /usr/lib/x86_64-linux-gnu/libgtk-3.so /usr/lib/x86_64-linux-gnu/libgdk-3.so /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so /usr/lib/x86_64-linux-gnu/libpango-1.0.so /usr/lib/x86_64-linux-gnu/libharfbuzz.so /usr/lib/x86_64-linux-gnu/libatk-1.0.so /usr/lib/x86_64-linux-gnu/libcairo-gobject.so /usr/lib/x86_64-linux-gnu/libcairo.so /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so /usr/lib/x86_64-linux-gnu/libgio-2.0.so /usr/lib/x86_64-linux-gnu/libgobject-2.0.so /usr/lib/x86_64-linux-gnu/libglib-2.0.so /usr/lib/x86_64-linux-gnu/libgegl-0.4.so /usr/lib/x86_64-linux-gnu/libgegl-npd-0.4.so -Wl,--export-dynamic /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so -pthread /usr/lib/x86_64-linux-gnu/libjson-glib-1.0.so /usr/lib/x86_64-linux-gnu/libbabl-0.1.so -lm -Wl,--end-group
FAILED: plug-ins/common/file-iff
cc  -o plug-ins/common/file-iff plug-ins/common/file-iff.p/file-iff.c.o -Wl,--as-needed -Wl,--no-undefined '-Wl,-rpath,$ORIGIN/../../libgimp:$ORIGIN/../../libgimpbase:$ORIGIN/../../libgimpcolor:$ORIGIN/../../libgimpconfig:$ORIGIN/../../libgimpmath:$ORIGIN/../../libgimpmodule:$ORIGIN/../../libgimpwidgets' -Wl,-rpath-link,....../gimp/builddir/libgimp -Wl,-rpath-link,....../gimp/builddir/libgimpbase -Wl,-rpath-link,....../gimp/builddir/libgimpcolor -Wl,-rpath-link,....../gimp/builddir/libgimpconfig -Wl,-rpath-link,....../gimp/builddir/libgimpmath -Wl,-rpath-link,....../gimp/builddir/libgimpmodule -Wl,-rpath-link,....../gimp/builddir/libgimpwidgets -Wl,--start-group libgimp/libgimp-3.0.so.0.9900.17 libgimpbase/libgimpbase-3.0.so.0.9900.17 libgimpcolor/libgimpcolor-3.0.so.0.9900.17 libgimpconfig/libgimpconfig-3.0.so.0.9900.17 libgimpmath/libgimpmath-3.0.so.0.9900.17 libgimp/libgimpui-3.0.so.0.9900.17 libgimpwidgets/libgimpwidgets-3.0.so.0.9900.17 /usr/lib/x86_64-linux-gnu/libgtk-3.so /usr/lib/x86_64-linux-gnu/libgdk-3.so /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so /usr/lib/x86_64-linux-gnu/libpango-1.0.so /usr/lib/x86_64-linux-gnu/libharfbuzz.so /usr/lib/x86_64-linux-gnu/libatk-1.0.so /usr/lib/x86_64-linux-gnu/libcairo-gobject.so /usr/lib/x86_64-linux-gnu/libcairo.so /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so /usr/lib/x86_64-linux-gnu/libgio-2.0.so /usr/lib/x86_64-linux-gnu/libgobject-2.0.so /usr/lib/x86_64-linux-gnu/libglib-2.0.so /usr/lib/x86_64-linux-gnu/libgegl-0.4.so /usr/lib/x86_64-linux-gnu/libgegl-npd-0.4.so -Wl,--export-dynamic /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so -pthread /usr/lib/x86_64-linux-gnu/libjson-glib-1.0.so /usr/lib/x86_64-linux-gnu/libbabl-0.1.so -lm -Wl,--end-group
/usr/bin/ld: plug-ins/common/file-iff.p/file-iff.c.o: in function `load_image':
file-iff.c:(.text+0x669): undefined reference to `ILBM_read'
/usr/bin/ld: file-iff.c:(.text+0x689): undefined reference to `ILBM_extractImages'
/usr/bin/ld: file-iff.c:(.text+0x7c3): undefined reference to `ILBM_imageIsACBM'
/usr/bin/ld: file-iff.c:(.text+0x7d6): undefined reference to `ILBM_convertACBMToILBM'
/usr/bin/ld: file-iff.c:(.text+0xafb): undefined reference to `ILBM_unpackByteRun'
/usr/bin/ld: file-iff.c:(.text+0xc1d): undefined reference to `ILBM_imageIsPBM'
/usr/bin/ld: file-iff.c:(.text+0xde0): undefined reference to `ILBM_freeImages'
collect2: error: ld returned 1 exit status


Can anybody give me a hand please?

Thanks...

Print this item

  Blending layers together
Posted by: fluffypanda - 07-12-2023, 09:13 AM - Forum: General questions - Replies (4)

Hi all I'm wanting to blend 2 layers together for a heightmap (where the red lines I have drawn)

Also is there a way to get the magic wand to select an area kind of like where the red lines area If I were the merge the 2 layers together rather than draw it manually with the free select tool? thanks Smile

[Image: R7d5Bew.jpg]

Print this item

  I want to achieve 2.10 posturize with color-erase blending mode effect in python
Posted by: Error - 07-12-2023, 01:37 AM - Forum: Other graphics software - Replies (1)

Hello, I am attempting to make a script of mine more efficient. I am trying to replicate the output of using posterize with the color-erase blending option in python without leaning heavily on gimp. Below is showing how posterize can influence an image's appearance.  
[Image: bugging-Me.png]
As you can see, this is what it looks like when I take the original photo, remove the alpha channel, and posterize. Below is one of the more interesting outcomes for the color-erase blending option when applied with the posterize tool.
[Image: asdaaa.png]
The step, by step instructions to get this effect:
1. Open image
2. Remove alpha channel of image by right clicking in layer menu
3. Select posterize from the color dropdown menu in the main window
4. In the posterize menu, select the color-erase blending mode and put the slider anywhere between 3 and 254.
Here's how to programmatically achieve the effect with Python-fu for 2.10:

Code:
groupLayer = pdb.gimp_layer_group_new(image)
srcLayer =  pdb.gimp_layer_copy(image.layers[0], False)
eraseLayer = pdb.gimp_layer_copy(image.layers[0], False)

#Insert layer group with two layers inside
pdb.gimp_image_insert_layer(image,groupLayer, None, -1)
pdb.gimp_image_insert_layer(image, srcLayer, image.layers[0], -1)
pdb.gimp_image_insert_layer(image, eraseLayer, image.layers[0], -1)

#Posterize erase layer, then set paint mode to Color Erase
pdb.gimp_layer_set_mode(eraseLayer, 57)
pdb.gimp_drawable_posterize(eraseLayer, amount)

#transfer grouplayer alpha to new mask, then fill alpha with white
mask = pdb.gimp_layer_create_mask(groupLayer, 3)
pdb.gimp_layer_add_mask(groupLayer, mask)
pdb.gimp_drawable_edit_fill(mask, 2)

# Apply mask and merge group
pdb.gimp_image_merge_layer_group(image, image.layers[0])
pdb.gimp_layer_remove_mask(image.layers[0], 0)

I'm interested in anything from theorizing, to gimp source-code that can explain how I could replicate this effect. I am curious how it works. If you've made it this far, thank you for reading my post!

Print this item

  How do I fill non contiguous areas of the same colour
Posted by: leamphil - 07-10-2023, 01:02 PM - Forum: General questions - Replies (6)

How do I fill all the areas (non contiguous ones) of the same colour with one click ? 
... without having to click on each non contiguous area

Regards,
Leamphil

Print this item

  Check Out a Loading Screen I made!
Posted by: eason9 - 07-10-2023, 09:56 AM - Forum: Gallery - Replies (8)

Took 15 mins to make it, check it out: https://ibb.co/SfL059K

Print this item

  Icon Shortcuts for predefined colors/tool/filter options
Posted by: estatistics - 07-09-2023, 08:46 AM - Forum: General questions - Replies (5)

I manipulate a lot of images.
I find it time consuming to click eg. 

filters-->blur-->Gaussian--> ok
then
Colors --> saturation --> Ok
then
filters-->enhance-->sharpen--> ok

then repeat the whole sequence for 1000+ images.

I prefer:
to be able to put Shortcut icons for predefined options in tools eg. Blur icon with predefined blurring.
to be able to group actions in new shortcut icons e.g blur-sharpen-saturation -> BSS shortcut icon.

In that way, the whole image processing will be speed up


I dont know if someone can make an addon for such thing.
It will be HUGE advantage of GIMP.

Print this item

Question New User!
Posted by: CallumC - 07-08-2023, 08:21 PM - Forum: General questions - Replies (3)

Please assume I am  a dummy, you wont be far wrong! 

Huh   How do I create a template?  How can I select from my pics and cut and paste into a template?  

Cry    Step by step please!


Yours MJC.

Print this item

  Partial desaturation and other processes with a car
Posted by: Ofnuts - 07-08-2023, 04:32 PM - Forum: Tutorials and tips - Replies (19)

From this:

   

To this:

   

One reason of the processing is the rather busy and uninteresting background (all buildings from the early 2000s) that distracts from the car.

Preprocessing:
  • Straighten the picture using the measure tool, taking the corner of the building across the street as a reference (best take the reference near the center of the picture because it is not subject to perspective convergence, and anyway the facade of the building to the right isn't vertical...)
  • Crop the picture to taste
  • There is a large blue flower pot to the right that creates a nasty blue reflection on the fender. Fixed by sampling the car color, and painting over the pot reflection  in "Lch color" mode.
Then it goes like this:

   
  • Make a path around the car (about 120 points)
  • Make a path around the windows (everywhere they are transparent or reflect something)
  • Using the windows path as a selection, copy/paste the windows on another layer
  • Make a copy of the image and colorize it (Colors> Colorize). The color is picked to have a hue about 180° from the car color (car color is H=240°, so colorization uses H=60°)  
  • Duplicate that colorize layer and  blur the copy
  • Create a selection from the outline path (Path to selection), and subtract the windows path (Subtract from selection)
  • On the initial image, create a layer mask and initialize it to the selection. You should end up with the car in original color over the "sharp" colorized layer
  • Add a layer mask on the colorized layer, and make a gradient to go from  a sharp image in the front to a blurred background
  • Adjust the opacity of the windows layer so that transparencies and reflections are between the original colors and the colorized background.

Print this item

  A bit of Nostalgia
Posted by: rich2005 - 07-08-2023, 10:47 AM - Forum: Watercooler - Replies (3)

In the evenings I like to pull out my old Acer C720 chromebook - no chrome here, it runs on a 32bit Xubuntu.

I am not into computer games but I do run a 1992 DOS Scrabble, playing against the computer and I did try to get a GIMP for you to see but had to use a 'wild-card'. This uses the official scrabble dictionary of the time. No modern words permitted.

   

A couple of days ago, even older, I found a 3.5" floppy with a DOS Tetris from 1988. I will have played this on my Amstrad DOS 3.3 with two 720MB floppy drives but no colour, a greenscreen monitor.  A nice touch, not a screensaver, a job-saver, in case the boss is snooping. Hit the pause key and you get a fake spreadsheet, looks a bit SuperCalc-ish but a giveaway is the date '1 April'

   

Print this item