Read .pgm in Julia v 1.0.1

298 Views Asked by At

How can i read/load .pgm file in julia. I am trying to read it through imread(".pgm") but compiler says that it only reads ".png" file. Is there any other command for that.

1

There are 1 best solutions below

2
On

You can use the Images.jl to read-in PGM file like this:

using Images
img = load("your_file_name.pgm")

Function load tries to infer the file type from its name and possibly magic bytes in the file so if your file has the pgm extension all should work fine.