logankilpatrick
logankilpatrick

Reputation: 14551

How to get the properties of an image in Julia

I am trying to figure out the dimensions of an image along with its type in a script so I can pre-set the length and width of my plot window. How can I do that using Julia?

Upvotes: 2

Views: 662

Answers (1)

Przemyslaw Szufel
Przemyslaw Szufel

Reputation: 42234

In Julia images are simply arrays. Just use size(img) full code below:

using Images
#requires using Pkg;pkg"add ImageMagikck"
img = load("photo.jpg")

Now get the size:

julia> typeof(img)
Array{RGB{Normed{UInt8,8}},2}

julia> size(img)
(2222, 2396)

If you want to display the image:

using ImageView
imshow(img)

Upvotes: 4

Related Questions