0

First of all a short disclaimer: I just started programming in c++ and I just started using Linux (Ubuntu) for developing. If it was for me I would delay this, but I cannot. Time to learn something new!

Scope: I need to develop a software which does some changes to a set of TIFF images. The algorithm seems to be working on a set of "fake" raster files. Now I need to load a TIFF image, turn it to RGB, apply the algorithm, get back to TIFF and save. I'm trying to use LibTiff to do so.

Problem: I need to use a standalone version of the libtiff library because I will need to Build&Run my software as guest on another machine. I can't install libraries there, so I need a pre-build one which I can directly include from my c++ code.

As an example I'd like to have something like this:

#include <stdio.h> 
#include "libtiffBin/tiffio.h" //Points to the standalone library and uses it  
int main (int argc, char** argv) 
{
  TIFF* tiff; 
  tiff = TIFFOpen ("samples/sample.tif", "r"); 
  TIFFClose (tiff); 
  return 0; 
}

Thanks for your help.

Nevril
  • 115
  • 2
  • 9

1 Answers1

0

You can download libtiff source code here. Download and extract the version you want. Navigate to the extracted directory and run ./configure and make to compile library. The ./libtiff/.libs/ directory contains the libtiff.a static library that can be included in your executable. To compile your executable use gcc main.c libtiff.a -lz -ljpeg -lm. Make sure you use the header files that correspond with your compiled library.

Alden
  • 2,229
  • 1
  • 15
  • 21