ImageEn, unit iemio

TImageEnMIO.DuplicateCompressionInfo

TImageEnMIO.DuplicateCompressionInfo


Declaration

procedure DuplicateCompressionInfo(IncludePDFInfo: Boolean = False);


Description

Clone the compression information of page 0 to all frames of the current image.
If IncludePDFInfo=True, PDF page properties are also duplicated.

The following properties are duplicated:

General
BitsPerSample
SamplesPerPixel

TIFF
TIFF_Compression
TIFF_PhotometInterpret
TIFF_PlanarConf
TIFF_Orientation
TIFF_EnableAdjustOrientation
TIFF_JPEGQuality
TIFF_JPEGColorSpace
TIFF_FillOrder
TIFF_ZIPCompression
TIFF_StripCount
TIFF_Normalize32fImages

GIF
GIF_Interlaced

ICO
ICO_Format

PS
PS_Compression

PDF
PDF_Compression
PDF_PaperWidth (if IncludePDFInfo=True)
PDF_PaperHeight (if IncludePDFInfo=True)
PDF_PageMargin  (if IncludePDFInfo=True)
PDF_ImageOptions (if IncludePDFInfo=True)

DICOM
DICOM_Range
DICOM_Compression
DICOM_JPEGQuality
DICOM_J2000Rate

Some other compression properties are also duplicated (though not used by multi-frame formats):
JPEG_ColorSpace, JPEG_Quality, JPEG_DCTMethod, JPEG_CromaSubsampling, JPEG_OptimalHuffman, JPEG_Smooth, JPEG_Progressive,
J2000_ColorSpace, J2000_Rate, J2000_ScalableBy, J2000_SubSamplingH, J2000_SubSamplingV, J2000_Reduce, J2000_Quality,
PNG_Interlaced, PNG_Filter, PNG_Compression,
TGA_Compressed, TGA_GrayLevel,
PCX_Version, PCX_Compression,
BMP_Version, BMP_Compression, BMP_HandleTransparency,
HDP_ImageQuality, HDP_Lossless
IEN_Compression, SVG_ImageCompression, PSD_LargeDocumentFormat


Examples

// Save monochrome TIFF
ImageEnMView1.MIO.Params[0].TIFF_Compression := ioTIFF_G4FAX;
ImageEnMView1.MIO.DuplicateCompressionInfo();
ImageEnMView1.MIO.SaveToFile('D:\output.tif');

// Save full-color TIFF
ImageEnMView1.MIO.Params[0].TIFF_Compression := ioTIFF_JPEG;
ImageEnMView1.MIO.Params[0].TIFF_JPEGQuality := 85;
ImageEnMView1.MIO.DuplicateCompressionInfo();
ImageEnMView1.MIO.SaveToFile('D:\output.tif');

// Create a multi-frame DICOM image from a source file list
procedure TForm1.CreateMultiDicom(sl: TStrings; SaveFilename: string);
var
  mbmp: TIEMultiBitmap;
  mio: TImageEnMIO;
  bmp : TIEBitmap;
  i: Integer;
begin
  mbmp := TIEMultiBitmap.create;
  mio := TImageEnMIO.CreateFromIEMBitmap(mbmp);

  for i := 0 to sl.count-1 do
  begin
    bmp := TIEBitmap.Create();
    bmp.ParamsEnabled := True;
    bmp.LoadFromFile(sl[i]);
    mbmp.AppendImage(bmp);
    bmp.Free;
  end;

  // Ensure all frames of DICOM are same size
  for I := 1 to mbmp.Count - 1 do
  begin
    bmp := mbmp.GetTIEBitmap( I );
    bmp.Resample( mbmp.ImageWidth[0], mbmp.ImageHeight[0], rfFastLinear );
    mbmp.ReleaseBitmap( I, True );
  end;

  // Ensure all frames of DICOM have same duplication and pixel format info
  mio.DuplicateCompressionInfo();

  mio.SaveToFileDICOM( SaveFilename );
  mio.Free;
  mbmp.free;
end;