This project has moved. For the latest updates, please go here.

Converting jpg to Tiled Pyramid TIFF for IIPImage

Feb 5, 2015 at 8:45 AM
I'm trying to convert a jpg image to Tiled Pyramid TIFF to use with IIPImage server.
I'm using the following code:
string source = @"image.jpg";
string target = @"image.tif";
using (MagickImage image = new MagickImage(source))
{
    // Sets the output format to jpeg

    image.SetDefine(MagickFormat.Ptif, "tiff:tile-geometry", "256x256");
    image.CompressionMethod = CompressionMethod.JPEG;
    image.Write(target);
}
I set the option by the command line exapmle in IIPImage docs:
"convert s -define tiff:tile-geometry=256x256 -compress jpeg 'ptif:o.tif'"
If i use the vips command line the tif is created correctly:
"vips im_vips2tiff source_image output_image.tif:deflate,tile:256x256,pyramid"

Thanks
Coordinator
Feb 5, 2015 at 8:05 PM
Edited Feb 6, 2015 at 9:21 PM
If you want to set the define tiff:tile-geometry you should use the following code:
image.SetDefine(MagickFormat.Tiff, "tile-geometry", "256x256");
I am trying to include some new classes in the next release that will make setting this easier. This will become something like this:
using (MagickImage image = new MagickImage(source))
{
  IDefines defines = new TiffWriteDefines()
  {
    TileGeometry = new MagickGeometry(256, 256)
  };
  image.SetDefines(defines);
}