Can't use load function in julia simple script

60 views Asked by At

I'm trying to load a image in Julia but it gives me the error:

ERROR: UndefVarError: load not defined
Stacktrace:
1 top-level scope @ c:\folde1\folder2\project.jl

My code is:

using TestImages, Images, Statistics, Plots
a = load("rachado1.jpeg")

I'm running the code using vscode with Julia v1.9
I already tried installing many packages (FileIO, ImageIO, ImageMagick), but the error persists.

I also tried in colab following these instructions (Julia in colab) and adding a new cell using the script above. But I got the same error.

1

There are 1 answers

0
Mark On BEST ANSWER

as Dan Getz said, the issue is not importing FileIO:


# Try to load the image
img = load("test.jpg") # ERROR: UndefVarError: load not defined


using FileIO # now instead import FileIO first

img = load("test.jpg") # it now loads successfully

hope this helps!