ImageEn, unit iexBitmaps

TIEMultiBitmap.DuplicateCompressionInfo

TIEMultiBitmap.DuplicateCompressionInfo

Declaration

procedure DuplicateCompressionInfo(IncludePDFInfo: Boolean = False);

Description

Clone the compression information from the image at index 0 to all other images.
If IncludePDFInfo=True, PDF page properties are also duplicated.

Note:
Only relevant if ParamsEnabled = True
Has no effect in IsVirtual mode

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

JPEG

JPEG_ColorSpace
JPEG_Quality
JPEG_DCTMethod
JPEG_CromaSubsampling
JPEG_OptimalHuffman
JPEG_Smooth
JPEG_Progressive

JPEG2000

J2000_ColorSpace
J2000_Rate
J2000_ScalableBy
J2000_SubSamplingH
J2000_SubSamplingV
J2000_Reduce
J2000_Quality

PCX

PCX_Version
PCX_Compression

BMP

BMP_Version
BMP_Compression
BMP_HandleTransparency

ICO

ICO_Format

PNG

PNG_Interlaced
PNG_Filter
PNG_Compression

TGA

TGA_Compressed
TGA_GrayLevel

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

Examples

// Change the compression method for a TIFF file
MBitmap := TIEMultiBitmap.Create();
MBitmap.ParamsEnabled := True;
MBitmap.LoadFromFile( 'C:\MyImage.tiff' );
MBitmap.Params[ 0 ].TIFF_Compression := ioTIFF_G4Fax;
MBitmap.DuplicateCompressionInfo();
MBitmap.SaveToFile( 'C:\OutImage.tiff' );
MBitmap.Free();

// Which is the same as:
MBitmap := TIEMultiBitmap.Create();
MParams := TIOMultiParams.Create();
MBitmap.LoadFromFile( 'C:\MyImage.tiff', MParams );
for i := 0 to MBitmap.Count do
  MParams[i].TIFF_Compression := ioTIFF_G4Fax;
MBitmap.SaveToFile( 'C:\OutImage.tiff', MParams );
MParams.Free();
MBitmap.Free();


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

  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
  mbmp.DuplicateCompressionInfo();

  mbmp.SaveToFile( SaveFilename, ioDICOM );
  mbmp.Free();
end;

// Save all pages to PDF (A4) with centered images (and no scaling of small images)
ImageEnMView1.MIO.Params[0].PDF_PaperSize  := iepA4;
ImageEnMView1.MIO.Params[0].PDF_PageMargin := Round( 0.25 * 72 );  // 1/4 inch
ImageEnMView1.MIO.Params[0].PDF_ImageOptions := [iepioShrinkOnly, iepioCentered];
ImageEnMView1.MIO.DuplicateCompressionInfo( True );
ImageEnMView1.MIO.SaveToFilePDF('D:\Test.pdf');