Browse our Products
Aspose.Imaging for .NET 18.3 - Release Notes
Key | Summary | Category |
---|---|---|
IMAGINGNET-2804 | Add support for SmallCap PSD option | Feature |
IMAGINGNET-2803 | Add support for Subscript PSD option | Feature |
IMAGINGNET-2630 | Support BMP header OS22XBITMAPHEADER | Feature |
IMAGINGNET-2572 | Support for converting CMYK PSD to CMYK Tiff | Feature |
IMAGINGNET-1850 | Conversion of RGB Color System to CMYK for Tiff File Format | Feature |
IMAGINGNET-2873 | Some public properties of ReaderDicomFileInfo class are missing in newest versions of Aspose.Imaging (starting from v16.12) | Enhancement |
IMAGINGNET-2868 | Exception on loading image | Enhancement |
IMAGINGNET-2861 | Image load exception is thrown on loading BMP | Enhancement |
IMAGINGNET-2859 | Exception is thrown on emf export to WMF with text rotation | Enhancement |
IMAGINGNET-2855 | An exception raises while saving to TIFF format | Enhancement |
IMAGINGNET-2854 | Dicom file not properly converted to PNGafter resize | Enhancement |
IMAGINGNET-2851 | Actualization of Aspose.Imaging .NET standalone installer program menu links | Enhancement |
IMAGINGNET-2815 | Conversion BMP to PNG throws an exception | Enhancement |
IMAGINGNET-2805 | Tiff with embedded color profiles, generated by Aspose.Imaging is not compatible with Photoshop | Enhancement |
IMAGINGNET-2802 | SVG with external resources not loaded | Enhancement |
IMAGINGNET-2668 | Tiff rotation without changing BPP | Enhancement |
IMAGINGNET-2666 | ODG to JPEG not properly converted | Enhancement |
IMAGINGNET-2658 | Fix EMF image export without license | Enhancement |
IMAGINGNET-2636 | Darker colors and color reproducibility | Enhancement |
IMAGINGNET-2631 | Exception on loading BMP Images | Enhancement |
IMAGINGNET-2227 | Concatenating TIFF images into single TIFF image is throwing exception | Enhancement |
Public API changes:
Added APIs:
Class Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader Class Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader Class Aspose.Imaging.FileFormats.OpenDocument.Objects.Graphic.OdPolyLine Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCompression.AlphaBitfields Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapCoreHeaderSize Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapInfoHeaderSize Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapInfoHeaderSizeV2 Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapInfoHeaderSizeV3 Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapInfoHeaderSizeV4 Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapInfoHeaderSizeV5 Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.Os22XBitmapHeaderFullSize Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.Os22XBitmapHeaderSize Method Aspose.Imaging.CmykColorHelper.ToCmykBytes(System.Int32[],System.Int32,System.Int32) Method Aspose.Imaging.CmykColorHelper.ToCmykIccBytes(System.Int32[],System.Int32,System.Int32,System.IO.Stream,System.IO.Stream) Method Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.#ctor Method Aspose.Imaging.FileFormats.Dicom.DicomImage.Save(System.IO.Stream,Aspose.Imaging.ImageOptionsBase,Aspose.Imaging.Rectangle) Method Aspose.Imaging.FileFormats.OpenDocument.Objects.Graphic.OdPolyLine.#ctor(Aspose.Imaging.FileFormats.OpenDocument.Objects.OdObject) Method Aspose.Imaging.FileFormats.Png.PngImage.DoUseRecursion(Aspose.Imaging.Image.ImageOperation) Method Aspose.Imaging.FileFormats.Png.PngImage.GetOriginalOptions Method Aspose.Imaging.Image.GetOriginalOptions Property Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapHeight Property Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapPlanes Property Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitmapWidth Property Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.BitsPerPixel Property Aspose.Imaging.FileFormats.Bmp.BitmapCoreHeader.HeaderSize Property Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.ExtraBitMasks Property Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader.ColorEncoding Property Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader.Identifier Property Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader.Recording Property Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader.Rendering Property Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader.Reserved Property Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader.Size1 Property Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader.Size2 Property Aspose.Imaging.FileFormats.Bmp.Os22XBitmapHeader.Units Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.DicomFound Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.DicomHeaderInfoByBytes Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.LengthValue Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.Offset Property Aspose.Imaging.FileFormats.OpenDocument.Objects.OdTransformInfo.SkewX Property Aspose.Imaging.FileFormats.OpenDocument.Objects.OdTransformInfo.SkewY Property Aspose.Imaging.FileFormats.Psd.PsdImage.RawDataFormat Property Aspose.Imaging.ImageOptions.Jpeg2000Options.Irreversible Property Aspose.Imaging.PixelDataFormat.Cmyka Property Aspose.Imaging.PixelDataFormat.Rgb16Bpp565
Removed APIs:
Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.BitmapInfoHeaderSize Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.BitmapInfoHeaderSizeV4 Field/Enum Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.BitmapInfoHeaderSizeV5 Method Aspose.Imaging.FileFormats.Dicom.DicomImage.Save(System.String,Aspose.Imaging.ImageOptionsBase) Property Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.BitmapHeight Property Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.BitmapPlanes Property Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.BitmapWidth Property Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.BitsPerPixel Property Aspose.Imaging.FileFormats.Bmp.BitmapInfoHeader.HeaderSize
Usage examples:
IMAGINGNET-2804 Add support for SmallCap PSD option
using (PsdImage image = Image.Load("smallCap.psd") as PsdImage)
{
image.Save("smallCap.png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
IMAGINGNET-2803 Add support for Subscript PSD option
string[] inputFiles = new string[]
{
"text",
"textReverse"
};
foreach (string inputFile in inputFiles)
{
using (PsdImage image = Image.Load(inputFile + ".psd") as PsdImage)
{
image.Save(inputFile + ".png", new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
}
}
IMAGINGNET-2630 Support Bmp header OS22XBITMAPHEADER [.Net]
string sourceFile = @"D:\source.bmp";
string resultFile = @"D:\result.png";
using (Image image = Image.Load(sourceFile))
{
image.Save(resultFile, new PngOptions());
}
IMAGINGNET-2572 Support for converting CMYK PSD to CMYK Tiff
Add to test project method:
private void PsdToTiffCmyk(string folder, bool isIccProfile)
{
string fileName = string.Format("cmyk_{0}.tiff", isIccProfile);
string inputFile = Path.Combine(folder,"cmyk.psd");
string inputIccFile = Path.Combine(folder,"JapanWebCoated.icc");
string outputFile = Path.Combine(folder,fileName);
using (Image image = Image.Load(inputFile))
{
if (isIccProfile)
{
using (MemoryStream ms = new MemoryStream(File.ReadAllBytes(inputIccFile)))
{
image.Save(outputFile, new TiffOptions(TiffExpectedFormat.TiffLzwCmyk) { IccProfile = ms });
}
}
else
{
image.Save(outputFile, new TiffOptions(TiffExpectedFormat.TiffLzwCmyk));
}
}
}
execute following code:
string folder = @"D:\tiff\";
//With IccProfile
this.PsdToTiffCmyk(folder,true);
//Without IccProfile
this.PsdToTiffCmyk(folder, false);
IMAGINGNET-1850 Conversion of RGB Color System to CMYK for Tiff File Format
string sourceFilePath = "testTileDeflate.tif";
string outputFilePath = "testTileDeflate Cmyk.tif";
TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffLzwCmyk);
using (Image image = Image.Load(sourceFilePath))
{
image.Save(outputFilePath, options);
}
string sourceFilePath = "testTileDeflate.tif";
string outputFilePath = "testTileDeflate Cmyk Icc.tif";
string cmykProfilePath = "RSWOP.ICM";
MemoryStream cmykProfile;
using (FileStream stream = new FileStream(cmykProfilePath, FileMode.Open))
{
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
cmykProfile = new MemoryStream(buffer);
}
TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffLzwCmyk);
options.IccProfile = cmykProfile;
using (Image image = Image.Load(sourceFilePath))
{
image.Save(outputFilePath, options);
}
IMAGINGNET-2873 Some public properties of ReaderDicomFileInfo class are missing in newest versions of Aspose.Imaging (starting from v16.12)
var file = @"MonochromeSample16_2.dicom";
using (var image = (DicomImage)Image.Load(file))
{
var fileInfo = image.FileInfo;
Console.WriteLine(fileInfo.LengthValue);
Console.WriteLine(fileInfo.DicomFound);
Console.WriteLine(fileInfo.DicomHeaderInfoByBytes.Length);
Console.WriteLine(fileInfo.Offset);
/* Output:
131072
True
1804
1804
*/
}
IMAGINGNET-2868 Exception on loading image [.Net]
var file = @"2000x4000px.png";
using (var image = (PngImage)Image.Load(file))
{
Console.WriteLine(image.FileFormat); // Png
}
IMAGINGNET-2861 Image load exception is thrown on loading BMP [.Net]
var file = @"E:\Work\Imaging\aspose.imaging.net\test\testdata\Images\Bmp\XING_B24.BMP";
using (var image = (BmpImage)Image.Load(file))
{
System.Diagnostics.Debug.Assert(image.FileFormat == FileFormat.Bmp);
System.Diagnostics.Debug.Assert(image.Width == 240);
System.Diagnostics.Debug.Assert(image.Height == 164);
System.Diagnostics.Debug.Assert(image.BitmapInfoHeader.BitmapXPelsPerMeter == 2834);
System.Diagnostics.Debug.Assert(image.BitmapInfoHeader.BitmapYPelsPerMeter == 2834);
System.Diagnostics.Debug.Assert(image.BitmapInfoHeader.BitmapCompression == 0);
}
IMAGINGNET-2859 Exception is thrown on emf export to wmf with text rotation
public void IMAGINGNET_2859()
{
int width = 16383;
int height = 16383;
EmfRecorderGraphics2D graphics = new EmfRecorderGraphics2D(
new Rectangle(0, 0, width, height),
new Size(width, height),
new Size((int)(width * 0.01), (int)(height * 0.01)));
Font font = new Font("Times New Roman", 80, FontStyle.Regular, GraphicsUnit.Point, CharacterSet.Default);
graphics.TranslateTransform(15700, 8100);
graphics.RotateTransform(90); //If remove rotation - exception not thrown
graphics.DrawString("R", font, Color.Red, 0, 0);
string outFile = "IMAGINGNET_2859_out.wmf";
using (EmfImage image = graphics.EndRecording())
using (Stream stream = new FileStream(outFile, FileMode.Create))
{
EmfRasterizationOptions rasterizationOptions = new EmfRasterizationOptions();
WmfOptions options = new WmfOptions();
options.VectorRasterizationOptions = rasterizationOptions;
image.Save(stream, options);
}
}
IMAGINGNET-2855 An exception raises while saving to TIFF format [.Net]
using (PsdImage image = Image.Load("tiffSave.psd") as PsdImage)
{
image.Save("tiffSave.tiff", new TiffOptions(TiffExpectedFormat.TiffNoCompressionRgba));
}
IMAGINGNET-2854 Dicom file not properly converted to Png after resize [.Net]
string inputFile = @"D:\IM-0001-0001.dcm";
string outputFile = @"D:\IM-0001-0001.dcm.png";
using (RasterImage image = (RasterImage)Image.Load(inputFile))
{
image.ResizeHeightProportionally(300, ResizeType.LanczosResample);
using (FileStream fs = File.Create(outputFile))
{
image.Save(fs, new PngOptions());
fs.Flush();
}
}
IMAGINGNET-2815 Conversion BMP to PNG throws an exception [.Net]
var file = @"decHex.bmp";
using (var image = (BmpImage)Image.Load(file))
{
Console.WriteLine(image.FileFormat); // Bmp
Console.WriteLine(image.Compression); // Bitfields
Console.WriteLine(image.BitsPerPixel); // 16
Console.WriteLine(image.RawDataSettings.PixelDataFormat.ToString()); // Rgb16Bpp565
image.Save(file + ".png", new PngOptions());
}
IMAGINGNET-2805 Tiff with embedded color profiles, generated by Aspose.Imaging is not compatible with Photoshop
string embeddedIccProfilePsd = @"gradation-cmyk-japan_color_2001_coated.psd";
using (PsdImage image = (PsdImage)Image.Load(embeddedIccProfilePsd))
{
image.UseRawData = true;
TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffLzwCmyk);
if (image.CmykColorProfile != null)
{
options.IccProfile = image.CmykColorProfile.Stream as MemoryStream;
}
image.Save(embeddedIccProfilePsd + ".new.tiff", options);
}
IMAGINGNET-2802 SVG with external resources not loaded
Add this class:
internal class SvgResourceSaver : SvgResourceKeeperCallback
{
internal delegate Stream GetResourceStreamDelegate(string resourceName);
internal delegate string GetResourcePathDelegate(string resourceName);
internal delegate string GetResourceNameDelegate(string extension);
private readonly GetResourceStreamDelegate getResourceStream;
private readonly GetResourcePathDelegate getResourcePath;
private readonly GetResourceNameDelegate getResourceName;
private readonly bool embeddedResources;
public bool ExportFotns { get; set; }
public SvgResourceSaver(
GetResourceStreamDelegate getResourceStream,
GetResourcePathDelegate getResourcePath,
GetResourceNameDelegate getResourceName)
{
this.getResourceStream = getResourceStream;
this.getResourcePath = getResourcePath;
this.getResourceName = getResourceName;
this.embeddedResources = false;
this.ExportFotns = true;
}
public SvgResourceSaver()
{
this.embeddedResources = true;
this.ExportFotns = true;
}
public override void OnFontResourceReady(FontStoringArgs args)
{
if (!this.ExportFotns)
{
args.FontStoreType = FontStoreType.None;
return;
}
if (this.embeddedResources)
{
args.FontStoreType = FontStoreType.Embedded;
}
else
{
args.FontStoreType = FontStoreType.Stream;
string extension = Path.GetExtension(args.SourceFontFileName);
string resourceName = this.getResourceName(extension);
args.DisposeStream = true;
args.DestFontStream = this.getResourceStream(resourceName);
args.FontFileUri = this.getResourcePath(resourceName);
}
}
public override string OnImageResourceReady(byte[] imageData, SvgImageType imageType, string suggestedFileName, ref bool useEmbeddedImage)
{
if (this.embeddedResources)
return base.OnImageResourceReady(imageData, imageType, suggestedFileName, ref useEmbeddedImage);
else
{
useEmbeddedImage = false;
string extension = Path.GetExtension(suggestedFileName);
string resourceName = this.getResourceName(extension);
using (Stream fs = this.getResourceStream(resourceName))
{
fs.Write(imageData, 0, imageData.Length);
}
return this.getResourcePath(resourceName);
}
}
}
Add this class:
internal class ImagingNet2802ExampleClass
{
private int counter;
private bool embedResources = false;
private bool exportFonts = true;
private readonly string folder;
public ImagingNet2802ExampleClass(string folder)
{
this.folder = folder;
}
public void Test(string inputFileName, string outputFileName)
{
SvgResourceSaver resourceSaver;
if (this.embedResources)
{
resourceSaver = new SvgResourceSaver();
}
else
{
resourceSaver = new SvgResourceSaver(this.GetResourceStream, this.GetResourcePath,
this.GetResourceName);
}
resourceSaver.ExportFotns = exportFonts;
SvgOptions svgOptions = new SvgOptions();
using (Image document = Image.Load(inputFileName))
{
EmfRasterizationOptions rasterizationOptions = new EmfRasterizationOptions();
rasterizationOptions.PageSize = document.Size;
svgOptions.VectorRasterizationOptions = rasterizationOptions;
svgOptions.Callback = resourceSaver;
using (MemoryStream svgMemoryStream = new MemoryStream())
{
document.Save(svgMemoryStream, svgOptions);
SvgImage image = new SvgImage(svgMemoryStream);
image.Save(outputFileName,
new PngOptions
{
VectorRasterizationOptions = new SvgRasterizationOptions {PageSize = image.Size}
});
}
}
}
private Stream GetResourceStream(string resourceName)
{
string fileName = Path.Combine(this.folder, resourceName);
return new FileStream(fileName, FileMode.Create);
}
private string GetResourcePath(string resourceName)
{
return Path.Combine(this.folder, resourceName);
}
private string GetResourceName(string extension)
{
string fName = this.counter++.ToString();
string fileName = Path.Combine(this.folder, fName + extension);
while (File.Exists(fileName))
{
fName = this.counter++.ToString();
fileName = Path.Combine(this.folder, fName + extension);
}
return fileName;
}
}
Excute this code:
string folder = @"D:\svg2802";
string inputFileName = "with-text-and-image.emf";
string inputFile = Path.Combine(folder, inputFileName);
string outputFile = Path.Combine(folder, inputFileName+".png");
ImagingNet2802ExampleClass tst = new ImagingNet2802ExampleClass(folder);
tst.Test(inputFile, outputFile);
IMAGINGNET-2668 Tiff rotation without changing bpp
Please take original_1bpp.png and use the following code to rotate it by 90 degrees clockwise to get original_1bpp_Rotate90FlipNone.png:
string dir = @"IMAGINGNET-2668\";
using (Aspose.Imaging.FileFormats.Png.PngImage image = (Aspose.Imaging.FileFormats.Png.PngImage)Aspose.Imaging.Image.Load(dir + "original_1bpp.png"))
{
image.RotateFlip(Aspose.Imaging.RotateFlipType.Rotate90FlipNone);
using (System.IO.Stream stream = new System.IO.FileStream(dir + "original_1bpp_Rotate90FlipNone.png", FileMode.Create))
{
image.Save(stream, image.GetOriginalOptions()); // Save as 1bpp Png.
}
}
IMAGINGNET-2666 Odg to jpeg not properly converted
string inputFileName = @"D:\example.odg";
string outputFileName = @"D:\example.odg.jpg";
using (Image image = Image.Load(inputFileName))
{
image.Save(outputFileName, new JpegOptions() { VectorRasterizationOptions = new EmfRasterizationOptions() { PageSize = image.Size } });
}
IMAGINGNET-2658 Fix EMF image export without license
// please test without license
string fileName = @"e:\temp\Picture1.emf";
using (Image mf = Image.Load(fileName))
{
EmfRasterizationOptions emfRasterizationOptions = new EmfRasterizationOptions();
emfRasterizationOptions.BackgroundColor = Color.Blue;
emfRasterizationOptions.PageWidth = 200;
emfRasterizationOptions.PageHeight = 200;
PngOptions pngOptions = new PngOptions();
pngOptions.VectorRasterizationOptions = emfRasterizationOptions;
mf.Save(fileName + "_IMAGINGNET-2007.png", pngOptions);
}
IMAGINGNET-2636 Darker colors and color reproducibility [.Net]
public void TestMethod()
{
string path = @"TestFiles\";
// Load Tiff image with embedded Icc
{
string embeddedIccProfileTiff = path + "Cmyk-CmykProfile.tif";
using (TiffImage image = (TiffImage)Image.Load(embeddedIccProfileTiff))
{
// get icc by property
MemoryStream profileStream = image.ActiveFrame.FrameOptions.IccProfile;
AssertProfile(profileStream);
// or get icc by tag
TiffDataType tag = image.ActiveFrame.FrameOptions.GetTagByType(TiffTags.IccProfile);
profileStream = new MemoryStream(tag.Value as byte[]);
AssertProfile(profileStream);
}
}
// Load Psd image with embedded Icc
{
string embeddedIccProfilePsd = path + "NavyExchangeCmyk.psd";
using (PsdImage image = (PsdImage)Image.Load(embeddedIccProfilePsd))
{
MemoryStream profileStream = image.CmykColorProfile.Stream as MemoryStream;
AssertProfile(profileStream);
}
}
// Convert Psd image with embedded Cmyk Icc to Tiff with embedded Cmyk Icc
{
string embeddedIccProfilePsd = path + "NavyExchangeCmyk.psd";
MemoryStream sourceIcc;
using (PsdImage image = (PsdImage)Image.Load(embeddedIccProfilePsd))
{
sourceIcc = image.CmykColorProfile.Stream as MemoryStream;
TiffOptions options = new TiffOptions(TiffExpectedFormat.TiffLzwCmyk) { IccProfile = sourceIcc };
image.Save(embeddedIccProfilePsd + "_output.tiff", options);
}
// verify saved profile
using (TiffImage image = (TiffImage)Image.Load(embeddedIccProfilePsd + "_output.tiff"))
{
MemoryStream profileStream = image.ActiveFrame.FrameOptions.IccProfile;
AssertProfile(profileStream);
Debug.Assert(Compare(profileStream.ToArray(), sourceIcc.ToArray()));
}
}
}
private void AssertProfile(MemoryStream profileStream)
{
Debug.Assert(profileStream != null);
}
private bool Compare(byte[] data1, byte[] data2)
{
if (data1.Length != data2.Length)
{
return false;
}
for (int i = 0; i < data2.Length; i++)
{
if (data1[i] != data2[i])
{
return false;
}
}
return true;
}
IMAGINGNET-2631 Exception on loading BMP Images [.Net]
string sourceFile = @"D:\source.bmp";
string resultFile = @"D:\result.png";
using (Image image = Image.Load(sourceFile))
{
image.Save(resultFile, new PngOptions());
}
IMAGINGNET-2227 Concatenating TIFF images into single TIFF image is throwing exception
Please unpack source TIFF images and use the following code to compose a new TIFF image from three unpacked TIFF images (case #1):
string dir = @"c:\aspose.work\IMAGINGNET\2227\";
string[] inputFiles = new string[]
{
"TWAIN-6130 A4 600 DUP 256COL_00001.tif",
"TWAIN-6130 A4 600 DUP 256COL_00002.tif",
"TWAIN-6130 A4 600 DUP 256COL_00003.tif",
};
TiffOptions createOptions = new TiffOptions(TiffExpectedFormat.Default);
createOptions.Compression = TiffCompressions.None;
TiffFrame[] frames = new TiffFrame[inputFiles.Length];
for (int i = 0; i < inputFiles.Length; ++i)
{
using (TiffImage input = (TiffImage)Image.Load(dir + inputFiles[i]))
{
frames[i] = TiffFrame.CreateFrameFrom(input.Frames[0], createOptions);
}
}
using (TiffImage output = new TiffImage(frames))
{
using (FileStream fileStream = new FileStream(dir + "ConcatThreeTiffImages Out.tif", FileMode.Create))
{
output.Save(fileStream);
}
}
Note that a conversion to the black-white 1 bit per pixel format takes place.
Please unpack source TIFF images and use the following code to add one of the unpacked TIFF images to another (case #2):
string dir = @"c:\aspose.work\IMAGINGNET\2227\";
string inputFilePath1 = dir + "TWAIN-6130 A4 600 DUP 256COL_00001.tif";
string inputFilePath2 = dir + "TWAIN-6130 A4 600 DUP 256COL_00002.tif";
string outputFilePath = dir + "ConcatTwoTiffImages Out.tif";
// Load the destination image
using (TiffImage image1 = (TiffImage)Image.Load(inputFilePath1))
{
// Load the source image
using (TiffImage image2 = (TiffImage)Image.Load(inputFilePath2))
{
// Create a copy of the active frame of the source image;
TiffFrame frame = TiffFrame.CopyFrame(image2.ActiveFrame);
// Add the copied frame to the destination image;
image1.AddFrame(frame);
// Save the image with changes;
image1.Save(outputFilePath);
}
}