views:

164

answers:

3

I need a way to take several jpgs and convert them into a single multi page Tiff. I have that working using GDI+ however it only works with the compression LZW which is lossless. This means that my 3 50KB Jpgs turn into 3MB multipage Tiff file. This is not something I can accept for the software that I am working on.

I know that Tiff Image format can use a JPG compression scheme but GDI+ does not seem to support this.

If anyone knows how to do this in .NET (C#) or of any component that does this conversion.

A: 

check this question. there useful links in first answer. http://stackoverflow.com/questions/297949/wpf-tiff-images-with-jpeg-compression

Andrey
The fact that I can't even find a price for teh Captiva product is probably a non starter. I can buy a component for $100. This does not look like it.
Adam Berent
@Adam Berent - if you have time you can implement it yourself, it is not that hard. the format is open.
Andrey
+1  A: 

BitMiracle LibTiff.net supports JPG (along along with propably all other Tiff codecs) as well as multipage tiffs. I have used it, though combined with other codecs, and had very good experiences with it; it is also well tested (unit tests included). Available under LGPL. Support is also very good (recently found an issue in files >2GB and I rapid response and updated code)

Hope this helps you. Sorry, I can't help being enthusiastic about the component as it helped me a great deal and is free.

Adriaan
starting from version 2.0 LibTiff.Net is freely available for all uses under a BSD license.
Bobrovsky
A: 

I work for Atalasoft and we have .NET tools that will do that easily.

public void CombineIntoTiff(string outputTiff, params string[] inputFiles)
{
    using (FileStream stm = new FileStream(outputTiff, FileMode.Create)) {
        TiffEncoder enc = new TiffEncoder();
        enc.Compression = TiffCompression.JpegCompression;
        enc.Append = true;
        foreach (string file in inputFiles) {
            AtalaImage image = null;
            try { image = new AtalaImage(file); } catch { continue; }
            enc.Save(image);
        }
    }
}

One thing to be aware of is that there are two flavors of JPEG compression in TIFF, one that is sanctioned by the standard and one that is acknowledged/barely tolerated. The latter, referred to as old-style JPEG, was bolted onto TIFF and is the cause of more broken files than any other compression in TIFF. The above code will use the standard compliant JPEG compression.

plinth