-
July 19th, 2018, 04:07 #1
getImageSize() possible w/o loading an image?
If I know the image node (say image.id-00001) is there anyway to get the image size of the bitmap in that node?
I'm having a hard time figuring out how to do it.---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
-
July 19th, 2018, 05:07 #2
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
OK. I haven't tried this but I think it should work.
Use a tiny image control somewhere on a window (it could probably even be invisible).
in 3.3.6, change the image file name to the filename of the image node (with the new getValue return values for your image you want to know size of and then using setVAlue for the imageControl's node to change the filename to the image you are querying [also a new 3.3.6 feature - see the question I asked MW yesterday or day before in the Laboratory thread.).
Query the control using getImageSize (i.e. myControl.getImageSize(), where myControl is an imageControl)
-
July 19th, 2018, 07:29 #3
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,539
We just chatted on Discord about this. I ended up suggesting something similar. (i.e. when you want to get the image size; create a simple window with only an imagecontrol, read the size, dispose of the window.)
I was thinking I might be able to just output the information if available already. However, the image size information is not available until the image is actually loaded; and the image is not loaded until it is needed (i.e. displayed in a control). Otherwise, load times would be ten times as long for data modules and campaigns.
Regards,
JPG
-
July 19th, 2018, 16:59 #4
Yeap, I was hoping to do this w/o loading but no API hooks to directly interact with the file so I'll load it up and see how it works.
Thanks for the tips.---
Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
Documentation for AD&D 2E ruleset.
Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks