STAR TREK 2d20
  1. #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.

  2. #2

    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)

  3. #3
    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

  4. #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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in