Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 4,767
» Latest member: litstiGup
» Forum threads: 6,976
» Forum posts: 38,099
Full Statistics
|
|
|
Newbie: Python script error |
Posted by: mike_b - 10-07-2020, 05:27 PM - Forum: Extending the GIMP
- Replies (1)
|
|
I am very new to the Python scripting in Gimp. I have used Gimp in the past for manipulating individual images, but now I have to run specific operations on hundreds of images. So I checked into the scripting options. I discarded Script-fu, as I am familiar with programming languages like C, C++, etc., but the Schemes thing is quite different. Python, on the other hand is similar enough.
So, to start out I looked at some sample scripts like this one:
Code:
import glob
source_folder = "c:/mysource_image_folder/" #type your folder inside the quotes - append the final "/"
dest_folder = "c:/destination_folder/"
for filename in glob.glob(source_folder + "/*.png"):
img = pdb.gimp_file_load(source_folder + filename, source_folder + filename)
pdb.gimp_drawable_brightness_contrast(img.layers[0], 0.2, 0)
pdb.gimp_file_save(img, img.layers[0], dest_folder + filename, dest_folder + filename)
pdb.gimp_image_delete(img) # drops the image from gimp memory
When I copy and paste that into the Python window, I get an error right away on the "import glob" line (I also get that error when I just type in "import glob"):
import glob
File "<input>", line 1
rt glob
^
SyntaxError: invalid syntax
So, obviously I am doing something wrong. Did I not install something right? I installed Python 3.7 (Win10), then reinstalled Gimp 2.10.20. Do I need to do something else?
And apologies if this is the wrong thread. Please point me to the right thread if so.
Thanks.
|
|
|
Easy cropping |
Posted by: Ethel - 10-07-2020, 02:57 PM - Forum: General questions
- Replies (6)
|
|
Hello,
What is the easiest way to explicitly crop from any edge? e.g. how to crop, say, 8px from the left, 10px from the right, and 12px from the bottom without using a mouse? A text box where I can enter the number or numbers I want would be good.
The instructions for changing a selection don't work for me. Can the same be done for a rectangular selection box using absolute or relative coordinates, i.e. a modal windows with four text boxes that dynamically shows the new selection rectangle on the image?
Thanks in advance
Ethel
|
|
|
new download haunted by old problem's ghost |
Posted by: mellyrn - 10-06-2020, 08:42 PM - Forum: General questions
- Replies (2)
|
|
I had Gimp 2.10.12 on my machine. While working an image, my fingers slipped and suddenly my tools/dialog box was much different: fewer tool icons were displayed, and the dialog box was completely unfamiliar: the dialog box also did not change depending on which tool (of the fewer tools) I chose. So while I can choose "text", I am, for example, unable to choose a font, and while I can choose "brush", I am unable to choose the size of my brush. The new dialog box window(s?) contain nothing.
I had been working with black as my foreground color and red as the background. That is relevant; please bear with me.
I went into Windows (10; 64-bit) "Settings" and uninstalled Gimp 2.10.12. I went to gimp.org and downloaded 2.10.20. I opened the new Gimp -- and I have the same reduced tool menu, the same unreadable, unworkable dialog box(es) -- AND THE SAME COLORS, black (foreground) & red (background).
I uninstalled & downloaded again. Didn't help.
I ran CCleaner, complete with "wipe free space", restarted my computer and tried again. Once again the new download displays the same abbreviated tool menu, the same lack of usable dialog for the tools, AND THE SAME COLORS.
??? It feels like the old, broken version is somehow "haunting" my machine & corrupting the new downloads....
Please note, in the image labeled "normal gimp" -- that's Gimp 2.8, which I have on an old machine, but the tool/dialog box looks much like what I *used* to have in 2.10.12, & what I expect to see:
|
|
|
Oversized window |
Posted by: halligant - 10-05-2020, 07:12 PM - Forum: General questions
- Replies (1)
|
|
Hello,
The gimp window fills the entire screen and I cannot access the unit or scale boxes at the bottom of the screen.
In addition the toolbox extends right down the screen and I cannot access the functions at the bottom.
Any help to resolve this issue would be gratefully received,
Yours,
halligant
|
|
|
|