0

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.

zx485
  • 28,498
  • 28
  • 50
  • 59
  • For `load` you would need `FileIO` and `ImageIO`, but not just installed, but imported. Try doing `using ImageIO` before the `load`. – Dan Getz Jun 12 '23 at 22:56

1 Answers1

2

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!

Mark
  • 7,785
  • 2
  • 14
  • 34