Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Having issues loading an image [SFML-2.0]  (Read 2799 times)

0 Members and 1 Guest are viewing this topic.

replaceits

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Having issues loading an image [SFML-2.0]
« on: October 19, 2012, 01:11:37 am »
Ok, so while writing a 2D platformer I ran into an issue I'm not quite understanding.
All of my images will load except one, no matter what format I put it in. All other images will load just fine (there also in the same directory as the other so i doubt its a rights problem).
It seems to only do this for images of this specific size, I have another image (same size) that it refuses to load also. The size is 21x15.
I attached the two images, any help?

Also here's the line of code...
if(!SprSmallStill.loadFromFile("Sprites\\Spr\\Small\\SprSmallStill.png")){return 1;}
    if(!SprSmallWalk.loadFromFile("Sprites\\Spr\\Small\\SprSmallWalk.png")){return 2;}
    if(!SprBigStill.loadFromFile("Sprites\\Spr\\Big\\SprBigStill.png")){return 3;}
    if(!SprBigWalk.loadFromFile("Sprites\\Spr\\Big\\SprBigWalk.png")){return 4;}

    //These two wont load
    if(!GroundBlock.loadFromFile("Sprites\\Scenery\\Nonint\\Block.png")){return 5;}
    if(!GroundPipe.loadFromFile("Sprites\\Scenery\\Nonint\\Pipe.png")){return 6;}

I all ways get this message while debugging as well
Failed to load image "Sprites\Scenery\Ground\Block.jpg". Reason : Unable to open
 file
I have checked all permissions and nothing seems wrong, any format i try to put it in, it wont load, it just seems to be this size.

[attachment deleted by admin]

Perde

  • Jr. Member
  • **
  • Posts: 63
    • View Profile
Re: Having issues loading an image [SFML-2.0]
« Reply #1 on: October 19, 2012, 01:52:39 am »
Failed to load image "Block.png". Reason : Corrupt PNG

Opening it in Gimp and simply hitting Ctrl+S fixed the problem for me.

replaceits

  • Newbie
  • *
  • Posts: 26
    • View Profile
    • Email
Re: Having issues loading an image [SFML-2.0]
« Reply #2 on: October 19, 2012, 02:39:41 am »
Ah! Thank you, I'm guessing my Paint Shop Pro is having issues saving small files, ill have to look into it.

 

anything