This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Tooniis's profile picture

(paintutils.drawImage) , Expected image, x, y

Started by Tooniis, 09 June 2015 - 10:48 AM
Tooniis #1
Posted 09 June 2015 - 12:48 PM
Hello Programmers!
Please help me fix this problem.
I started to make a program,

this is the startup image code:

local startupImage = paintutils.loadImage("startup")
paintutils.drawImage( startupImage,1,1 )


this is the error that I get when I run it:

TurtleController:2: Expected image, x, y

the image is available and it is in the same directory as the program.

Please reply. :)/>
Edited on 09 June 2015 - 02:52 PM
Cranium #2
Posted 09 June 2015 - 04:16 PM
Moved to Ask a Pro.
flaghacker #3
Posted 09 June 2015 - 04:22 PM
Is your imagefile called "startup"? And have you made your image in the build-in paint program?
Tooniis #4
Posted 09 June 2015 - 04:39 PM
Yes I did, the name is startup and i checked that several times
flaghacker #5
Posted 09 June 2015 - 06:09 PM
Could you post the result of you typing "dir" in the console? (as a picture)
Edited on 09 June 2015 - 04:09 PM
Tooniis #6
Posted 09 June 2015 - 06:20 PM
How to upload a picture from my PC into my post?
KingofGamesYami #7
Posted 09 June 2015 - 07:57 PM
I'd simply upload it to imgur or an equivalent image hosting site and post the link (or the BBC embed code).
Bomb Bloke #8
Posted 10 June 2015 - 01:27 AM
the image is available and it is in the same directory as the program.

If that directory isn't the root of your drive then you'll need to pass it to paintutils.loadImage, which requires absolute paths.

Eg, using shell.resolve():

local startupImage = paintutils.loadImage(shell.resolve("startup"))
Tooniis #9
Posted 10 June 2015 - 02:53 AM
Could you post the result of you typing "dir" in the console? (as a picture)
this is the result:



the image is available and it is in the same directory as the program.

If that directory isn't the root of your drive then you'll need to pass it to paintutils.loadImage, which requires absolute paths.

Eg, using shell.resolve():

local startupImage = paintutils.loadImage(shell.resolve("startup"))
Then what is the root directory? or should I only use shell.resolve() function as you did?
Edited on 10 June 2015 - 12:54 AM
Tooniis #10
Posted 10 June 2015 - 03:00 AM
I tried adding shell.resolve() function, and it WORKED FINALLY! thanks guys for your help! it is solved