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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,725
» Latest member: AbbyShipma
» Forum threads: 7,225
» Forum posts: 39,441

Full Statistics

Latest Threads
How long do ethernet cabl...
Forum: Watercooler
Last Post: dacq
11 hours ago
» Replies: 0
» Views: 31
How to remove the right-s...
Forum: General questions
Last Post: dacq
11 hours ago
» Replies: 0
» Views: 40
Adding path edit new feat...
Forum: General questions
Last Post: Ofnuts
Yesterday, 07:45 AM
» Replies: 1
» Views: 120
Drag & Drop in Layers Not...
Forum: General questions
Last Post: Ofnuts
03-13-2025, 10:52 PM
» Replies: 2
» Views: 142
Making a Selection from a...
Forum: Gimp 2.99 & Gimp 3.0
Last Post: Ofnuts
03-13-2025, 10:48 PM
» Replies: 1
» Views: 99
Automate croping without ...
Forum: General questions
Last Post: rich2005
03-13-2025, 09:31 PM
» Replies: 1
» Views: 100
Display problem in Gimp 2...
Forum: OSX
Last Post: beaubrunb
03-13-2025, 10:27 AM
» Replies: 0
» Views: 81
Exported jpg different th...
Forum: General questions
Last Post: rich2005
03-13-2025, 08:49 AM
» Replies: 6
» Views: 269
Antique Metal Qt 300 for ...
Forum: Extending the GIMP
Last Post: vitforlinux
03-12-2025, 01:43 PM
» Replies: 0
» Views: 152
Non-destructive edtiing i...
Forum: Tutorials and tips
Last Post: teapot
03-12-2025, 01:41 PM
» Replies: 5
» Views: 376

 
  Python Fu Image Creation - Slight Issues
Posted by: BaconWizard17 - 12-31-2022, 06:00 AM - Forum: Scripting questions - Replies (10)

Hi all,

I decided to finally start learning Python-Fu (I'm already familiar with Python), and I've been getting a feel for it by converting some of my older Script-Fu scripts to Python-Fu. It's going well so far, and I've been able to convert a few. Currently, I'm working on one of my scripts to create a preview image template. Formerly, I had a series of scripts that I could use to create different sized previews. I've streamlined it to one single new Python-Fu script with two sliders that allow me to customize how big I want the preview image canvas. The sliders determine the number of rows and columns, and then the image and guides are generated from that. The script works well, but there are two issues:

  1. When I don't have any images open, and I run this script, the dialog for it appears, and there are two dropdowns at the top for "Input Image" and "Input Drawable", above the sliders for number of rows and columns. Both say "(Empty)," and that's the only option. If I already have another image open, these dropdowns don't appear. Is this normal? Is there any way to prevent these from appearing? 
  2. The image, when created, is black. The older script-Fu scripts (that essentially had the same coding) would create a white image. I'm sure there are many ways to make the image white, but how do I default to that?
Here's the Python-Fu code:
Code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gimpfu import*

def multiSkinPreviewAny (theImage, theLayer, columns, rows):
   # Establish the dimensions of the image based on the number of rows and columns
   theImageWidth = 543 * columns
   theImageHeight = 1080 * rows
   # Create the image
   theImage = pdb.gimp_image_new(theImageWidth, theImageHeight, 0)
   # Create the main layer
   theLayer = pdb.gimp_layer_new(theImage, theImageWidth, theImageHeight, 0, "Background", 100, 28)
   # Add the layer to the image
   pdb.gimp_image_add_layer(theImage, theLayer, 0)
   # Add guides at the top left and bottom right
   guide = pdb.gimp_image_add_vguide(theImage, 0)
   guide = pdb.gimp_image_add_hguide(theImage, 0)
   guide = pdb.gimp_image_add_vguide(theImage, theImageWidth)
   guide = pdb.gimp_image_add_hguide(theImage, theImageHeight)
   i = 0
   # Add 1 vertical guide for every column
   while i < columns:
       xcoord = i * 543
       guide = pdb.gimp_image_add_vguide(theImage, xcoord)
       i += 1
   # Re-initiate the counter
   i = 0
   # Add 1 horizontal guide for every row
   while i < rows:
       ycoord = i * 1080
       guide = pdb.gimp_image_add_hguide(theImage, ycoord)
       i += 1
   # Display the new image
   display = pdb.gimp_display_new(theImage)

register(
   "python_fu_marvelmods_common_multiskinpreviewany",
   "Create template grid for skin preview images.",
   "Create template grid for skin preview images.",
   "BaconWizard17",
   "BaconWizard17",
   "December 2022",
   "<Image>/Marvel Mods/Skin Previews/Multi Skin Showcase/Custom Size Skin Preview",
   "",
   [
       (PF_SLIDER, "columns", "Number of Columns:", 2, (1, 8, 1)),
       (PF_SLIDER, "rows", "Number of Rows:", 2, (1, 8, 1))
   ],
   [],
   multiSkinPreviewAny)

main()

And here's one of the Script-Fu scripts for comparison:
Code:
; 2x2 grid skin preview for XML2/MUA1 skins
(define (script-fu-mua-xml2-2x2-preview)
    (let*
        (
            ; define our local variables
            ; create a new image:
            (theImageWidth  1086)
            (theImageHeight 2160)
            (theImage
                (car
                    (gimp-image-new
                        theImageWidth
                        theImageHeight
                        RGB
                    )
                )
            )
            ; background layer
            (theLayer
                (car
                    (gimp-layer-new
                        theImage
                        theImageWidth
                        theImageHeight
                        RGBA-IMAGE
                        "Background"
                        100
                        LAYER-MODE-NORMAL
                    )
                )
            )
        ) ;end of our local variables
        ; add the layers
        (gimp-image-add-layer theImage theLayer 0)
        ; add the guides
        (gimp-image-add-hguide theImage 1080)
        (gimp-image-add-vguide theImage 543)
        ; show the new image on the screen
        (gimp-display-new theImage)
   )
)
; populate script registration information
(script-fu-register
   "script-fu-mua-xml2-2x2-preview"
   "2x2 Skin Preview"
   "Creates an image for a 2x2 grid preview for 4 skins."
   "BaconWizard17"
   "BaconWizard17"
   "September 2021"
   ""
)
; register the script within gimp menu
(script-fu-menu-register "script-fu-mua-xml2-2x2-preview" "<Image>/Marvel Mods/Skin Previews/Multi Skin Showcase")

Any input is appreciated!

Print this item

  Pasting from MS Snip is only B/W
Posted by: RealGomer - 12-31-2022, 12:24 AM - Forum: General questions - Replies (3)

I'll use ms snip to clip excerpts from email to paste into GIMP 2.10. For some reason, the pasted image is only in B?W (gray tone) not color. Why?

Print this item

  Adjust Color Levels Menu Problem
Posted by: OKCarl - 12-31-2022, 12:11 AM - Forum: Windows - Replies (2)

Every time I try to 'crop to content' the 'Adjust Color Levels Menu' pops up in front of my project. Consequently, I am unable to crop my image. How do I turn off the 'Adjust Color Levels Menu'?

Print this item

  Speeding up gimp scripts
Posted by: DaltonCalford - 12-30-2022, 06:18 PM - Forum: Extending the GIMP - Replies (1)

I have a process that runs, but is very slow.

I am looking for ways to speed up gimp - such as stopping the gimp UI from updating for every step it is performing.

I am running Script-Fu and the process itterates through a series of layers called "textures" and another series of layers called "templates"
and it performs a series of steps based upon the template and for each step, saves the result to a file in the appropriate directory.

It takes about 2 seconds per file output, but, given the number of files to be generated, it could take weeks, so even a small optimization would make a large difference.

I am running on linux, writting to a ssd, with 64GB of ram which is barely touched.   I have a high end amd cpu (12 core) and a high end video card, but, it is still running slow.

So if it is trying to say, keep a undo log or any other unnessary steps, how do I shut those off?

Any help is appreciated.

Thanks

Print this item

  Mirror images to 4/8 sides
Posted by: Zwergchen - 12-30-2022, 03:20 PM - Forum: General questions - Replies (2)

Hey there,
how can I mirror an image in this way?
[Image: Unbenannt.png]

I need it to create seamless textures ^^

While editing the "main", all the "mirrors" should be updated.
And if possible, the "mirrors" shouldn´t be paintable.


My current workflow is to mirror it by myself a lot of times till it is perfectly how I want it, but it´s a horrible way...

Print this item

  Microsoft ICE like stitching
Posted by: meetdilip - 12-30-2022, 01:03 PM - Forum: General questions - Replies (9)

Hi, is it possible to stitch images into a seamless one like Microsoft ICE using GIMP?

Trying to stitch multiple images into one for Blender texture. Thanks

PS: Is there any tiled view like in Krita? - View > Wrap Around Mode

Print this item

  Clone brush not going active
Posted by: Muzician - 12-30-2022, 06:33 AM - Forum: General questions - Replies (5)

I'm trying to use the Clone Tool and keep getting the not active status icon - i.e. the circle with a slash through it image next to the tool pointer and nothing happens on the image when I click on it. Tried various images, tried shutting down and re-opening Gimp. I'm sure it's something simple I'm overlooking. 

Any suggestions? 

Thanks.

Print this item

  How can I redraw a line in the diagram
Posted by: andreas5gfrei - 12-29-2022, 06:22 AM - Forum: General questions - Replies (7)

Hello
I am a Gimp beginner, although I have already mastered the basics.

Attached are two graphics: One shows a diagram in black and white. I need a revision, as shown in the other image: the diagram in red, the rest remains black.

The red line should remain as thin as possible and be smoothed, not like in my example with these outliers.

Since I have to revise a lot of these charts like this, I'm looking for a very quick solution so I don't have to spend a lot of time on this.

Thanks for any good tips.

Greetings
Andreas



Attached Files Thumbnail(s)
   
Image(s)
   
Print this item

  Fun fact: the Gimp doc says something is better explained on this forum
Posted by: Ofnuts - 12-26-2022, 11:14 AM - Forum: Gimp-Forum.net - Replies (2)

See the description of the Flow parameter in the Smudge tool description.

Print this item

  Looks easier without Gimp
Posted by: Ofnuts - 12-25-2022, 10:55 PM - Forum: Watercooler - Replies (1)

https://twitter.com/buitengebieden/statu...5013306374

Print this item