0

I'm trying to adjust image levels with pgmagick on Windows 7, Python 3.5.1.

All the variations I've come up with either end up with an almost completely white image or the error below:

Traceback (most recent call last):
  File "test.py", line 7, in <module>
    im.level('48%,0.5,52%')
Boost.Python.ArgumentError: Python argument types in
    Image.level(Image, str)
did not match C++ signature:
    level(class Magick::Image {lvalue}, double, double, double)

I've also tested my level settings on Photoshop so they make sense and don't result in a white picture. Here's my code:

from pgmagick import Image

im = Image('image.jpg')
im.level('48%,0.5,52%')       # not working
# im.level('48%', 0.5, '52%') # not working
# im.level(48,0.5,52)         # no error but picture almost completely white

Just to note, I was able to adjust the image levels with Node.js running the following code:

gm('image.jpg')
.level('48%', 0.5, '52%')

Any help and ideas are very much appreciated!

t4--
  • 1
  • 1
  • I don't know anything about these Python bindings, but it looks to me like the error message is suggesting you pass 3 doubles, whereas you have strings with percent signs in them. I guess you need `im.level(48.0,0.5,52.0)` or something like that... maybe. – Mark Setchell Apr 25 '18 at 06:51
  • A good idea, but no luck. No error, but it returns an almost white picture (as if the level settings were 0, 0, 0) – t4-- Apr 28 '18 at 07:59
  • Maybe try 48% of 255 (122.4) and 52% of 255 (132.6)? – Mark Setchell Apr 28 '18 at 08:02
  • Tried that too, and again only white. It's as if none of the settings affect anything. The default values 0,1,100 that should work also return the almost white picture. I'm running out of permutations to try! :D – t4-- Apr 28 '18 at 15:19
  • Huh, I think it takes in 16bit integers, so ranging from 0 to 65,535. Thanks for your help! – t4-- Apr 28 '18 at 19:17

0 Answers0