Registriert seit: 26. Mai 2011
Ort: Dülmen
13 Beiträge
Delphi 2010 Professional
|
AW: GDI + tif - MultiPage - Bild wird dunkler
20. Jul 2012, 13:08
Hallo,
versuch es mal hiermit:
Delphi-Quellcode:
procedure ExtractTiffPages(aFileName: string);
var
encoderParameters : TEncoderParameters;
parameterValue : TEncoderValue;
image : TGPImage;
count, frameCount : UINT;
DimensionIDs : PGUID;
i, j : integer;
encoderClsid : TGUID;
OutFile : string;
FilePath : string;
type
TGUIDDynArray = array of TGUID;
begin
FilePath := ExtractFilePath(aFileName);
Image := TGPImage.Create(aFileName);
// Initialize the one EncoderParameter object.
encoderParameters.Count := 1;
encoderParameters.Parameter[0].Guid := EncoderCompression;
encoderParameters.Parameter[0].Type_ := EncoderParameterValueTypeLong;
encoderParameters.Parameter[0].NumberOfValues := 1;
encoderParameters.Parameter[0].Value := @parameterValue;
parameterValue := EncoderValueCompressionLZW;
// How many frame dimensions does the Image object have?
count := image.GetFrameDimensionsCount;
GetMem(DimensionIDs, count * SizeOf(TGUID));
// Get the list of frame dimensions from the Image object.
image.GetFrameDimensionsList(DimensionIDs, count);
GetEncoderClsid('image/tiff', encoderClsid);
for i := 0 to count - 1 do
begin
// Get the number of frames in dimension.
frameCount := image.GetFrameCount(TGUIDDynArray(DimensionIDs)[i]);
for j := 0 to frameCount - 1 do
begin
OutFile := FilePath + IntToStr(i) + '-' + IntToStr(j) + '.tif';
image.SelectActiveFrame(TGUIDDynArray(DimensionIDs)[i], j);
image.Save(OutFile, encoderClsid, @encoderParameters);
end;
end;
freemem(DimensionIDs);
image.Free;
end;
Hierbei sollten die Farben erhalten beleiben.
Gruß
Gernot
|
|
Zitat
|