Failing to open and write .tiff images


When I try to convert a .jpg image to a .tiff file I get the following message:

TImage *img1 = TImage::Open("/Users/cashcrusaders/Documents/cluster/Archive/cluster.jpg");
    if (!img1) {
        printf("Could not create an image... exit\n");

But I get the following message:

Error in <TASImage::WriteImage>: error writing file cluster.tiff

I also tried to open a sample .tiff image that I got from the net using the following:

 TImage *img = TImage::Open("FLAG_T24.tiff")

where IsValid() return false. Is there perhaps something wrong with the way I installed ROOT?

If LibAfterImage does not have support for TIFF, then ROOT may be unable to do the conversion. However, if you are just converting a JPEG to TIFF, I highly recommend using ImageMagick’s convert tool, as it can convert from/to many other formats as well and is really easy to use. In your case, you can do convert cluster.jpg cluster.tiff and it should just work. Cheers,

I need to check. I think it does.

The support for TIFF in LibAfterImage is optional, so it may or may not be enabled.

I thought that because since astiff is ON by default when building ROOT then I would be able to open TIFF files. How do I go about enabling TIFF support for LibAfterImage?


So I tried recompiling libafterimage using the following commands in order to enable support for tiff in /graf2d/asimage/src/libAfterImage:

./configure  --with-tiff-includes=/usr/local/include 
make -j4 

I then reinstalled ROOT but I get the following error:

Undefined symbols for architecture x86_64:
  "_XDisplayHeight", referenced from:
      _asim_asxml_var_init in libAfterImage.a(afterbase.o)
  "_XDisplayWidth", referenced from:
      _asim_asxml_var_init in libAfterImage.a(afterbase.o)
  "_XGetGeometry", referenced from:
      _asim_get_drawable_size in libAfterImage.a(afterbase.o)
  "_XLookupColor", referenced from:
      _asim_parse_argb_color in libAfterImage.a(afterbase.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)```

You can also try to use an external installation of libafterimage, by setting -Dbuiltin_afterimage=OFF and installing in your own OS the devel package for it. Most Linux distributions do have it. BTW, if you are on a Mac, have you tried simply using brew install root to get ROOT? It may just be enough for what you need.

Hi I just installed ROOT using brew but I still can’t write tiff images. I have also tried loading the libtiff libraries using gSystem but that did not seem to work either. Might there might be something wrong with my code…?

Sorry. I forgot to mention that I am using ROOT 6.18.0

That probably means that the libAfterImage shipped by Homebrew does not have support for TIFF. I really recommend to just write another format and convert to TIFF later with ImageMagick.

Yeah maybe that would be the better option at this point. Thank you very much