-
Create Multipage Tiffs
I'm going nuts trying to create a multipage tiff from several pre-existing single page tiffs. I understand that i need to utilize bitmap.saveadd to make this work. Things just really aren't working out on all this for me. The encoderparamaters and such are driving me nuts. could anyone help? I just want to take 2 single page tiffs and save them as a single multipage tiff
Thanks!
-
Oh yeah theirs a beautiful MSDN example in c# but that doesnt help me one darn bit.. heres that example
VOID Example_SaveAdd(HDC hdc)
{
Graphics graphics(hdc);
EncoderParameters encoderParameters;
ULONG parameterValue;
GUID dimension = FrameDimensionPage;
// An EncoderParameters object has an array of
// EncoderParameter objects. In this case, there is only
// one EncoderParameter object in the array.
encoderParameters.Count = 1;
// Initialize the one EncoderParameter object.
encoderParameters.Parameter[0].Guid = EncoderSaveFlag;
encoderParameters.Parameter[0].Type = EncoderParameterValueTypeLong;
encoderParameters.Parameter[0].NumberOfValues = 1;
encoderParameters.Parameter[0].Value = ¶meterValue;
// Get the CLSID of the TIFF encoder.
CLSID encoderClsid;
GetEncoderClsid(L"image/tiff", &encoderClsid);
// Create an image object based on a TIFF file that has four frames.
Image fourFrames(L"FourFrames.tif");
// Save the second page (frame).
parameterValue = EncoderValueMultiFrame;
fourFrames.SelectActiveFrame(&dimension, 1);
fourFrames.Save(L"TwoFrames.tif", &encoderClsid, &encoderParameters);
// Save the fourth page (frame).
parameterValue = EncoderValueFrameDimensionPage;
fourFrames.SelectActiveFrame(&dimension, 3);
fourFrames.SaveAdd(&encoderParameters);
// Close the multiframe file.
parameterValue = EncoderValueFlush;
fourFrames.SaveAdd(&encoderParameters);
// Draw the two frames of TwoFrames.tif.
Image twoFrames(L"TwoFrames.tif");
twoFrames.SelectActiveFrame(&dimension, 0);
graphics.DrawImage(&twoFrames, 10, 10);
twoFrames.SelectActiveFrame(&dimension, 1);
graphics.DrawImage(&twoFrames, 150, 10);
}