2015-12-23, 23:14
Greetings,
In my application, I am loading one of many .jpgs of unknown width and height. My GUI will have a height limit, but not a width limitation.
Therefore, I want to scale the image based on the height, and center it based on the width.
I'm not getting the expected feedback from getWidth, that I wanted. It seems this is giving me the Control Objects width, and not the image's width.
What I see is this:
The height being what I set in the XML file, and retaining the aspect ratio.
But the width is definitely not right. Every image I select returns the same value.
Can I actually get the image's width/height? I definitely need something from the width, so I can center this image.
Thanks!
In my application, I am loading one of many .jpgs of unknown width and height. My GUI will have a height limit, but not a width limitation.
Therefore, I want to scale the image based on the height, and center it based on the width.
I'm not getting the expected feedback from getWidth, that I wanted. It seems this is giving me the Control Objects width, and not the image's width.
Code:
caller_img=self.getControl(CALLER_IMG)
caller_img.setImage(__hf_addondir__ + get_kodi_prop("caller_name") + ".jpg")
call_img_width=caller_img.getWidth()
call_img_height=caller_img.getHeight()
log("width: " + str(call_img_width))
log("height: " + str(call_img_height))
What I see is this:
Code:
16:02:09 T:140537859438336 NOTICE: HFXML: width: 640
16:02:09 T:140537859438336 NOTICE: HFXML: height: 256
The height being what I set in the XML file, and retaining the aspect ratio.
But the width is definitely not right. Every image I select returns the same value.
Can I actually get the image's width/height? I definitely need something from the width, so I can center this image.
Thanks!