Home > other >  Images loading without full resolution (Julia)
Images loading without full resolution (Julia)

Time:10-19

I have a .NEF file on my Desktop titled "my_image.nef". If I look at the details of the image, I see a resolution of 4256x2832:

enter image description here

When I try to open this with Julia, I get a two-dimensional array of size 120x160.

enter image description here

How do I get a full-resolution array to load? Why is it loading a much smaller version of the original image?

CodePudding user response:

I'm not an expert on various RAW file formats, but it's probably loading the thumbnail preview. There's good reason to hope this may be fairly easily resolvable: like many RAW formats, it appears to be a variation on TIFF, and Julia's TiffImages package is an amazingly good TIFF library. It's possible you'd have to create a "wrapper package" specifically for RAW or NEF, but it's might end up being a fairly short exercise in piecing together the correct series of calls to TiffImages internals. I encourage you to file an issue at TiffImages to discuss it.

CodePudding user response:

I ended up using the Julia command prompt to iteratively call ImageMagick, locally converting all the .NEF files to .PNG files and reading in the PNG files as arrays.

using Glob
using Shell

filenames = glob(string("*",".NEF"), <IMAGE DIR>)
for file in filenames
    fname = split(split(file,"\\")[end],".")[1]
    fname1 = string(img_folder, fname, ".NEF")
    fname2 = string(img_folder, fname, ".png")
    cmd = string("convert ", fname1, " ", fname2)
    Shell.run(cmd)
end

Sloppy, but there didn't seem to be a tidy Julia-based package that worked well.

  • Related