Resize image by fractions throws exception
Opened this issue · 0 comments
Svenito commented
If you try to resize an image with a fraction (0.5) a TypeError exception is thrown. This is because the call to cv.CreateImage expects int not float types. I would suggest casting w and h to int.
scaled_bitmap = cv.CreateImage((int(w), int(h)), 8, 3)
example:
img = Image("img.jpg")
img.resize(img.width * 0.5, img.height * 0.5)
Not sure if this is acceptable, but it would make more sense than casting the arguments to the resize call to int. I have a pull request lined up, but due to my vim's whitespace cleanup it's going to push a lot of whitespace changes, so I need to redo the commit if this change is acceptable.