It is currently Thu Jul 04, 2024 4:08 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Python-fu gimp_drawable_levels(): "TypeError: wrong parameter type"
PostPosted: Tue Nov 16, 2021 11:36 pm  (#1) 
Offline
GimpChat Member

Joined: Jun 25, 2016
Posts: 5
Posted this as a bug, but I'm not sure if it is a bug. I just rediscovered this forum, so hoped I could get an answer here.

Environment/Versions

GIMP version:
AppImage 2.10.22 with plugins
Linux Mint 20.2


Description of the bug
I can't find out how to use python-fu command gimp_drawable_levels. I think I've got everything correct, but the error message is unhelpful, and I don't know what to change. I suspect it's a bug, but have found so little documentation regarding this feature that I can't be sure I'm using it right.

Reproduction
Is the bug reproducible? Always.
Reproduction steps:

open python-fu console
paste this:

from gimpfu import *

input_path = '/path/to/input.png'
output_path = '/path/to/output.png'
image = pdb.gimp_file_load(input_path, input_path)

# red
pdb.gimp_drawable_levels(
image,
HISTOGRAM_RED,
0.050980392156862744,
0.95686274509803926,
False,
1.0,
0.0,
1.0,
False
)

Expected result:
no error
Actual result:
Traceback (most recent call last):
File "", line 10, in
TypeError: wrong parameter type


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Python-fu gimp_drawable_levels(): "TypeError: wrong parameter type
PostPosted: Wed Nov 17, 2021 1:39 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 13, 2011
Posts: 2260
Location: Poland
Hi Ipsod.
pdb.gimp_drawable_levels(drawable, channel, low_input, high_input, clamp_input, gamma, low_output, high_output, clamp_output)
You should use 'layer' not 'image'

_________________
Image

Slava
Ukraini!


Top
 Post subject: Re: Python-fu gimp_drawable_levels(): "TypeError: wrong parameter type
PostPosted: Thu Nov 18, 2021 4:59 am  (#3) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
MareroQ wrote:
Hi Ipsod.
pdb.gimp_drawable_levels(drawable, channel, low_input, high_input, clamp_input, gamma, low_output, high_output, clamp_output)
You should use 'layer' not 'image'


To be more accurate, since your loaded image has a single layer, you can obtain the drawable from your image using either "image.active_drawable" or "image.layers[0]".

This said, since it looks like you want to process files in batch, you should really look at ImageMagick, which is designed to be used in shell scripts. You possibly want to explore "-level-colors {black_color}{,}{white_color}" together with "-channel type".

_________________
Image


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts wrong parameter type in pdb.plug_in_cubism

9

No new posts "Wrong parameter type" using Map object (Solved)

7

No new posts Attachment(s) TypeError: could not convert to GimpRGB (Solved)

5

No new posts [RESOLVED] Colors->Levels, explain Clamping, and Level ranges

2

No new posts Attachment(s) How to reproduce Gimp's levels using blend modes of color fills

0



* Login  



Powered by phpBB3 © phpBB Group