GMS 2 sprite_save() failed - no bitmap data available

Discussion in 'Programming' started by SupernaturalCow, Jul 30, 2019.

  1. SupernaturalCow

    SupernaturalCow Member

    Joined:
    Sep 11, 2016
    Posts:
    152
    I'm getting this error when trying to use sprite_save(spr_background, 0, "saves/bg/image.png").

    I've ruled out the immediately obvious: the sprite index points to a valid sprite, and the image index points to a valid image within that sprite with pixels in it. Anyone have any other ideas as to why GM might be thinking there's no bitmap data available?
     
  2. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,889
    "/saves/bg/image.png" ?
     
  3. SupernaturalCow

    SupernaturalCow Member

    Joined:
    Sep 11, 2016
    Posts:
    152
    Well a leading slash takes me to the root directory (Y:// in this case), but "./" seems to achieve the same as omitting it... hm.

    Edit: So yeah the error's still occurring.
     
    Last edited: Jul 30, 2019
  4. TheouAegis

    TheouAegis Member

    Joined:
    Jul 3, 2016
    Posts:
    6,889
    Try removing the second argument. I know the help file says there are three arguments, but the help file also has an example using only the first and last arguments. lol

    Edit: nevermind, apparently they fixed that typo in the second manual. Lol

    Since this is studio 2, I have an urge to ask this: what code did you use to create spr_background? And how did you verify that it is a proper existing Sprite?or is it a Sprite resource that you already included in the project to begin with, which kind of begs the question why you would need to save it. lol
     
    Last edited: Jul 30, 2019
  5. SupernaturalCow

    SupernaturalCow Member

    Joined:
    Sep 11, 2016
    Posts:
    152
    It's a Sprite resource, because I haven't gotten to implementing programmatically generated sprites yet, lol. Once I get sprite_save to work for a built-in resource, then I'll try it with a generated one.
     
  6. IndianaBones

    IndianaBones Member

    Joined:
    Jul 5, 2016
    Posts:
    2,207
    Are you using this sprite as part of a tileset?

    If you are, you might have to uncheck "DIsable Source Sprite Export" in the Tileset settings.
     
  7. SupernaturalCow

    SupernaturalCow Member

    Joined:
    Sep 11, 2016
    Posts:
    152
    I like the thinking, but alas it's not part of a tileset :(
     
  8. dreenot

    dreenot Member

    Joined:
    Mar 28, 2018
    Posts:
    4
  9. SupernaturalCow

    SupernaturalCow Member

    Joined:
    Sep 11, 2016
    Posts:
    152
    dreenot likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice