Problem Saving TIFF Images


#1

Hi!

I’ve got trouble saving images in .tiff format.
Am I doing something seriously wrong with this code?
(I’ve got ImageMagick and QuartzImageIO installed)

using Images
using TestImages

img = testimage("moonsurface.tiff")
save("img.tiff", img)

This gives me the following error asking me if I want to install OMETIFF:

Error encountered while saving "img.tiff".
Fatal error:
Library "OMETIFF" is not installed but is recommended as a library to load format: ".tiff"
Should we install "OMETIFF" for you? (y/n):

If I install OMETIFF it fails too, because OMETIFF only reads tiff files as I understand it.

I think I have to convince FileIO to use ImageMagick or QuartzImageIO? Savers for these are already added. So if i use add_saver I get this and calling save still asks me to install OMETIFF:

add_saver(format"TIFF", :ImageMagick)
3-element Array{Symbol,1}:
 :QuartzImageIO
 :ImageMagick  
 :ImageMagick  

Edit:

Solved it somehow by using the following:

io = ("myimg.tiff", "w")
save(Stream(format"TIFF", io), img)
close(io)

But now I’ve got an additional problem, because I want to save the image in 16bit. Is there a 16bit tiff saver available anywhere?


#2

From my experience with Images, it will save the image in 16 bit if the eltype of your image array is 16 bit (i.e. N0f16).