This can be done by writing a program using the LibTIFF API.  The TIFF file format is a container that supports multiple compression schemes.  The compressed image data is stored in the TIFF file along with tags that contain various information about the image.  In some cases, the compressed data can stand alone without the extra TIFF information, so it can be extracted and used separately.  There might be existing software that can do this, but if none can be found a program like the following can be built using LibTIFF:

#include <tiffio.h>

#include <stdlib.h>

#include <stdint.h>


int main (int argc, char *argv[])


    const char *input_tiff_file;

    const char *output_image_data_file;

    tsize_t size;

    char *image_data;

    int len;

    TIFF *t;

    FILE *fout;


    /* Input and output file from command line */

    input_tiff_file = argv[1];

    output_image_data_file = argv[2];


    /* Open the input TIFF file */

    t = TIFFOpen(input_tiff_file, “r”);


    /* Read the strip size and allocate a buffer */

    size = TIFFStripSize(t);

    image_data = malloc(size);


    /* Read data from the first strip */

    len = TIFFReadRawStrip(t, 0, image_data, size);


    /* Write the strip data to the output file */

    fout = fopen(output_image_data_file, “wb”);

    fwrite(image_data, len, 1, fout);



    /* Done */



    return 0;


This program takes two filenames as command line arguments.  The first is an input TIFF file, the second will receive the extracted image data.  First the input TIFF file is opened using the function TIFFOpen.  Then the program reads the strip size which tells how big of a buffer is needed to hold the encoded image data.  Then the image data is read using TIFFReadRawStrip.  This function reads the strip data as-is without attempting to decode it.  Finally, the strip data is written to the output file.