How to put an image into a game

I wanted to put an image into my game but don’t know if I’m doing it right. I put the jpg image into the mygame folder and put in the code below where I wanted the image but the Quicktest comes up with an error that the file doesn’t exist and if I test the game manually the image doesn’t appear.

*image Land_Ad.jpg 

Looking at the wiki may prove useful if you haven’t already. :slight_smile: And IIRC quicktest/randomtest isn’t equipped to show images. You’d have to use Dashingdon to test that out.

1 Like

I looked at that, but the quicktest gets stuck on the image line as I get File Doesn’t exist and it won’t go past it

That’s because Choicescript is drawing from the text files only. You need to use Dashingdon and upload whatever image files you need in order to view the pictures.

So I assume then you are saying I have to take that piece of code out to test it. Then my other questions is why can’t i see the image when I manually play the game?

Yes, you’d have to either take that code out or put a *comment command in front of it so it doesn’t trigger choicescript.

Is the image not loading?

Yeah when I manually play the game all I get is a little square where the image should be but it doesn’t load

Have you checked the filename is exactly the same you’re using in the code? (I’m hazarding a guess and thinking it might even be case sensitive.)

If it’s not loading at all, then it obviously isn’t only a quicktest error.

1 Like

Yes I checked it and even cut and copied the name just in case and it’s the same name

Convert the file to png and be sure to check that the image is inside your my game folder. Png and gif are the best formats to use both in game and in dashingdon. Dashingdon limits the size file so be sure to check out pages to compress the image accordingly

Ok thanks I’ll try that

1 Like

I recommend you check out this thread to learn more about headers size of images and a lot of stuff.


Don’t know what kind of computer you’re using, but make sure you’re actually seeing the file extension, not just assuming it.

Some computers do not distinguish between .jpg and .jpeg, so that could be why the name of the file you’re using doesn’t match.

Lastly, try renaming the image file something completely different that is all lowercase and no special symbols (i.e. don’t use a “_”) and see if that fixes the problem.

And as @poison_mara said, make sure your image file isn’t too gigantic as that might be what’s causing the “blank square” to pop up as it’s simply too large to load. There are free websites online that can help you resize an image.

Your code as shown above is fine. It’s just a question of getting your computer to find that rascally file!

Thanks that helped

Changing it to a png seemed to have solved the problem and the image appears now.

Thanks both of you for your help

1 Like

The golden rule with images is always to use png or gif and check out the size and compression of them.