Browse our Products
Aspose.Imaging for .NET 20.5 - Release notes
Key | Summary | Category |
---|---|---|
IMAGINGNET-3731 | Support for extracting paths from TIFF | Feature |
IMAGINGNET-3417 | Allow speed or memory optimization strategies for Dicom format | Feature |
IMAGINGNET-3724 | Support of export readable full frame gif to multipage image formats | Feature |
IMAGINGNET-3822 | 18.8-20.3: Cannot draw semi transparent image | Enhancement |
IMAGINGNET-3821 | Imaging WMF to PDF conversion issues | Enhancement |
IMAGINGNET-3820 | Exception combining TIFF images | Enhancement |
IMAGINGNET-3819 | ImageSave exception on exporting to PDF | Enhancement |
IMAGINGNET-3812 | Removing Subject and Comments from Tiff properties | Enhancement |
IMAGINGNET-3764 | On conversion from EMF to PNG or SVG a black “border” appears | Enhancement |
Compact framework off notice:
Please note in next Aspose.Imaging releases support of .NET Compact Framework in Aspose.Imaging will be removed. # Public API changes: Added APIs:
Class Aspose.Imaging.FileFormats.Dicom.DicomImageInfo Class Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.BezierKnotRecord Class Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.ClipboardRecord Class Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.InitialFillRuleRecord Class Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.LengthRecord Class Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.PathFillRuleRecord Class Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathRecord Class Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathRecordFactory Class Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType Class Aspose.Imaging.FileFormats.Tiff.PathResources.PathResource Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.ClipboardRecord Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.ClosedSubpathBezierKnotLinked Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.ClosedSubpathBezierKnotUnlinked Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.ClosedSubpathLengthRecord Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.InitialFillRuleRecord Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.OpenSubpathBezierKnotLinked Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.OpenSubpathBezierKnotUnlinked Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.OpenSubpathLengthRecord Field/Enum Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathType.PathFillRuleRecord Field/Enum Aspose.Imaging.FileFormats.Tiff.Enums.TiffTags.PhotoshopResources Field/Enum Aspose.Imaging.FileFormats.Tiff.Enums.TiffTags.XPAuthor Field/Enum Aspose.Imaging.FileFormats.Tiff.Enums.TiffTags.XPComment Field/Enum Aspose.Imaging.FileFormats.Tiff.Enums.TiffTags.XPKeywords Field/Enum Aspose.Imaging.FileFormats.Tiff.Enums.TiffTags.XPSubject Field/Enum Aspose.Imaging.FileFormats.Tiff.Enums.TiffTags.XPTitle Method Aspose.Imaging.FileFormats.Dicom.DicomImage.#ctor(Aspose.Imaging.ImageOptions.DicomOptions,System.Int32,System.Int32) Method Aspose.Imaging.FileFormats.Dicom.DicomImage.AddPage Method Aspose.Imaging.FileFormats.Dicom.DicomImage.InsertPage(System.Int32) Method Aspose.Imaging.FileFormats.Dicom.DicomImage.RemovePage(System.Int32) Method Aspose.Imaging.FileFormats.Gif.Blocks.GifFrameBlock.GetFullFrame Method Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.BezierKnotRecord.#ctor(System.Byte[]) Method Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.ClipboardRecord.#ctor(System.Byte[]) Method Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.InitialFillRuleRecord.#ctor(System.Byte[]) Method Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.LengthRecord.#ctor(System.Byte[]) Method Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.PathFillRuleRecord.#ctor(System.Byte[]) Method Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathRecord.#ctor Method Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathRecordFactory.#ctor Method Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathRecordFactory.ProducePathRecord(System.Byte[]) Method Aspose.Imaging.FileFormats.Tiff.PathResources.PathResource.#ctor Method Aspose.Imaging.FileFormats.Webp.WebPFrameBlock.GetFullFrame Method Aspose.Imaging.IAnimationFrame.GetFullFrame Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.BitsAllocated Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.Blues Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.DicomHeaderInfoByBytes Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.DicomInfo Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.Greens Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.Height Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.IsLittleEndian Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.NumberOfFrames Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.Offset Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.PhotoInterpretation Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.PixelRepresentation Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.PlanarConfiguration Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.Reds Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.RescaleIntercept Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.RescaleSlope Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.SamplesPerPixel Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.SignedImage Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.Width Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.WindowCentre Property Aspose.Imaging.FileFormats.Dicom.DicomImageInfo.WindowWidth Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.BezierKnotRecord.IsClosed Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.BezierKnotRecord.IsLinked Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.BezierKnotRecord.IsOpen Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.BezierKnotRecord.Points Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.BezierKnotRecord.Type Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.ClipboardRecord.Type Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.InitialFillRuleRecord.IsFillStartsWithAllPixels Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.InitialFillRuleRecord.Type Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.LengthRecord.IsClosed Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.LengthRecord.IsOpen Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.LengthRecord.Type Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.PathFillRuleRecord.Type Property Aspose.Imaging.FileFormats.Psd.Layers.LayerResources.VectorPaths.VectorPathRecord.Type Property Aspose.Imaging.FileFormats.Tiff.PathResources.PathResource.BlockId Property Aspose.Imaging.FileFormats.Tiff.PathResources.PathResource.Name Property Aspose.Imaging.FileFormats.Tiff.PathResources.PathResource.Records Property Aspose.Imaging.FileFormats.Tiff.TiffFrame.PathResources Property Aspose.Imaging.ImageOptions.TiffOptions.XPAuthor Property Aspose.Imaging.ImageOptions.TiffOptions.XPComment Property Aspose.Imaging.ImageOptions.TiffOptions.XPKeywords Property Aspose.Imaging.ImageOptions.TiffOptions.XPSubject Property Aspose.Imaging.ImageOptions.TiffOptions.XPTitle Property Aspose.Imaging.ImageOptionsBase.FullFrame
h2. Removed APIs:
Class Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo Method Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.#ctor(System.IO.Stream) Method Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.ReleaseManagedResources Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.BitsAllocated Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.Blues Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.DicomFound Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.DicomHeaderInfoByBytes Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.DicomInfo Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.Greens Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.Height Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.HeightTagFound Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.IsLittleEndian Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.LengthValue Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.NumberOfFrames Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.Offset Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.PhotoInterpretation Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.PixelRepresentation Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.PlanarConfiguration Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.Reds Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.RescaleIntercept Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.RescaleSlope Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.SamplesPerPixel Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.SignedImage Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.Width Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.WidthTagFound Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.WindowCentre Property Aspose.Imaging.FileFormats.Dicom.ReaderDicomFileInfo.WindowWidth
Usage Examples:
IMAGINGNET-3731 Support for extracting paths from TIFF
### Clipping Path
Clipping path is the Photoshop technique to remove the background from an image.
Photoshop allows you to select a part of an image
using Clipping Path and save the path within a file. Clipping Paths allow you to
hide the part of an image you don’t want to appear.
Anything inside the clipping path will be visible, but anything outside of it
will be transparent.
Other words Photoshop makes it possible to isolate certain parts of an image,
without permanently changing the layer.
This allows you to tweak the image at any point in the creative process.
Clipping Paths are a traditional method of cutting
out objects or people in Photoshop that allows you to create image files with
transparent backgrounds. This approach works best
with objects or people with “hard” edges around the object or person you want to
cut out.
### Access Clipping Paths in TIFF image
*PathResources* property allows you to access Clipping Paths in TIFF frame.
The following code retrieves paths from TIFF image
and displays their names in the console:
using (var image = (TiffImage)Image.Load("Sample.tif"))
{
foreach (var path in image.ActiveFrame.PathResources)
{
Console.WriteLine(path.Name);
}
}
### Modify existing Clipping Paths
You can easily modify already existing Clipping Paths. For instance, you can
keep only one Clipping Path in the image:
using (var image = (TiffImage)Image.Load("Sample.tif"))
{
var paths = image.ActiveFrame.PathResources;
image.ActiveFrame.PathResources = paths.Take(1).ToList();
image.Save();
}
### Create Clipping Path manually
You can manually create Clipping Path in TIFF image. In order to do that you
need to create an instance of *PathResource* class.
The following code demonstrates the way how you can create an empty path in TIFF
image:
var options = new TiffOptions(TiffExpectedFormat.Default);
var frame = new TiffFrame(options, 800, 600);
using (var image = new TiffImage(frame))
{
image.ActiveFrame.PathResources = new List\<PathResource\>
{
new PathResource
{
BlockId = 2000,
Name = "My Clipping Path",
Records = new List\<VectorPathRecord\>()
}
};
image.Save("ImageWithEmptyPath.tiff");
}
### Clipping Path content
To create your own Clipping Paths you need to understand their content.
Photoshop stores its paths as resources with IDs in
the range 2000 through 2997. The name of the resource is the name given to the
path when it was saved. If the file contains a
resource with an ID of 2999, then this resource contains the name of the
clipping path. Each path has a set of records to hold the data.
**Record classes:**
*LengthRecord* - contains the number of Bezier knot records.
*BezierKnotRecord* - describes the knots of the path.
*ClipboardRecord* - contains four fixed-point numbers for the bounding
rectangle.
More details you can find in
[Adobe Photoshop File Formats Specification]
(https://www.adobe.com/devnet-apps/photoshop/fileformatashtml/).
IMAGINGNET-3822 18.8-20.3: Cannot draw semi transparent image
using (Image backgoundImage = Image.Load("image1.png"))
{
Graphics graphics = new Graphics(backgoundImage) { SmoothingMode =
SmoothingMode.HighQuality };
ImageAttributes imageAttributes = new ImageAttributes();
ColorMatrix colorMatrix = new ColorMatrix { Matrix33 = 0.5f };
imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default,
ColorAdjustType.Bitmap);
RectangleF rect = new RectangleF(0, 0, backgoundImage.Width / 3f,
backgoundImage.Height);
using (Image icon = Image.Load("icon1.png"))
{
graphics.DrawImage(icon, rect, GraphicsUnit.Pixel, imageAttributes);
}
backgoundImage.Save("output_Net.20.3.png");
}
IMAGINGNET-3724 Support of export readable full frame gif to multipage image formats
// Added support for full-frame export from gif format
string baseDirectoryPath = \@"D:\\";
string fileName = "Animation.gif";
string inputFilePath = Path.Combine(baseDirectoryPath, fileName);
string outputFilePath = inputFilePath + "_FullFrame.tif";
string outputFilePath1 = inputFilePath + "_NonFullFrame.tif";
using (Image image = Image.Load(inputFilePath))
{
image.Save(outputFilePath, new
TiffOptions(TiffExpectedFormat.TiffDeflateRgb)
{ MultiPageOptions = new MultiPageOptions(new
IntRange(2, 5)), FullFrame = true });
image.Save(outputFilePath1, new
TiffOptions(TiffExpectedFormat.TiffDeflateRgb)
{ MultiPageOptions = new
MultiPageOptions(new IntRange(2, 5))});
}
IMAGINGNET-3821 Imaging WMF to PDF conversion issues
public void FileToPdf(Stream input, Stream output)
{
using (var image = Image.Load(input))
{
var exportOptions = new PdfOptions
{
PdfDocumentInfo = new
Aspose.Imaging.FileFormats.Pdf.PdfDocumentInfo(),
VectorRasterizationOptions =
new
Aspose.Imaging.ImageOptions.WmfRasterizationOptions
{ PageWidth = image.Width, PageHeight =
image.Height }
};
image.Save(output, exportOptions);
}
}
IMAGINGNET-3819 ImageSave exception on exporting to PDF
public static void FileToPdf()
{
String path = \@"C:\\Users\\mudas\\Downloads\\svg_example\\";
using (var image = Image.Load(path+ "svg_example.svg"))
{
var exportOptions = new PdfOptions
{
PdfDocumentInfo = new
Aspose.Imaging.FileFormats.Pdf.PdfDocumentInfo(),
VectorRasterizationOptions =
new
Aspose.Imaging.ImageOptions.SvgRasterizationOptions
{ PageWidth = image.Width, PageHeight =
image.Height }
};
image.Save(path+"svg.pdf", exportOptions);
}
}
IMAGINGNET-3812 Removing Subject and Comments from Tiff properties
private static void CleanExifData(TiffOptions frameOptions)
{
frameOptions.Artist = null;
frameOptions.Copyright = null;
frameOptions.DateTime = null;
frameOptions.DocumentName = null;
frameOptions.ImageDescription = null;
frameOptions.PageName = null;
frameOptions.InkNames = null;
frameOptions.ScannerManufacturer = null;
frameOptions.ScannerModel = null;
frameOptions.SoftwareType = null;
frameOptions.TargetPrinter = null;
frameOptions.XPTitle = null;
frameOptions.XPComment = null;
frameOptions.XPAuthor = null;
frameOptions.XPKeywords = null;
frameOptions.XPSubject = null;
}
IMAGINGNET-3764 On conversion from EMF to PNG or SVG a black “border” appears
// Added support for TernaryRasterOperations (SrcAnd,SrcPaint,SrcInvert) in
metafiles
// (emf, wmf). This will allow you to get // more correct images when
rasterizing metafiles.
string baseFolder = "D:";
string file = "x.emf";
string inputFileName = Path.Combine(baseFolder, file);
string outputFileName = inputFileName + ".png";
using (Image image = Image.Load(inputFileName))
{
EmfRasterizationOptions emfRasterizationOptions = new
EmfRasterizationOptions();
emfRasterizationOptions.PageSize = image.Size;
image.Save(outputFileName, new PngOptions() { VectorRasterizationOptions =
emfRasterizationOptions });
}
IMAGINGNET-3820 Exception combining TIFF images
public static void CombineImageFiles(string fpDest, string[] safp)
{
safp = safp.Where(File.Exists).ToArray();
if (safp.Length == 0)
{
return;
}
using (TiffImage image = (TiffImage)Image.Load(safp[0]))
{
List\<IDisposable\> srcImages = new List\<IDisposable\>();
for (int fileIndex = 1; fileIndex \< safp.Length; fileIndex++)
{
TiffImage srcImage = (TiffImage)Image.Load(safp[fileIndex]);
srcImages.Add(srcImage);
foreach (TiffFrame srcFrame in srcImage.Frames)
{
// removing XMP data to prevent System.MissingMethodException
srcFrame.XmpData = null;
TiffFrame frame = TiffFrame.CopyFrame(srcFrame);
image.AddFrame(frame);
}
}
try
{
TiffOptions outputSettings = new
TiffOptions(TiffExpectedFormat.Default);
ResolutionSetting res = new ResolutionSetting(300, 300); // 300 x
300 DPI
outputSettings.BitsPerSample = new ushort[] { 4 };
outputSettings.Compression = TiffCompressions.Lzw;
outputSettings.Photometric = TiffPhotometrics.Palette;
outputSettings.Palette =
ColorPaletteHelper.Create4BitGrayscale(false);
outputSettings.ResolutionSettings = res;
// Setting empty page exporting action to activate the
// batch export mode (needed for economical use of memory)
// It is available in Aspose.Imaging 20.3+
image.PageExportingAction = (index, page) =\> { };
image.Save(fpDest, outputSettings);
}
finally
{
foreach (IDisposable srcImage in srcImages)
{
srcImage.Dispose();
}
}
}
}
IMAGINGNET-3417 Allow speed or memory optimization strategies for Dicom format
// Example 1. Setting a memory limit of 50 megabytes for operations on the created Dicom image
var imageOptions = new DicomOptions();
imageOptions.Source = new FileCreateSource("created.dcm", false);
imageOptions.BufferSizeHint = 50;
using (Image image = Image.Create(imageOptions, 1000, 1000))
{
// Do something with the created image
//...
image.Save();
}
// Example 2. Setting a memory limit of 20 megabytes for operations on the loaded Dicom image
var loadOptions = new LoadOptions();
loadOptions.BufferSizeHint = 20;
using (Image image = Image.Load("image.dcm", loadOptions))
{
// Do something with the loaded image
//...
}
// Example 3. Settings a memory limit of 30 mebagytes for export-to-dicom operation
var loadOptions = new LoadOptions();
loadOptions.BufferSizeHint = 30;
using (Image image = Image.Load("image.png", loadOptions))
{
image.Save("exported.dcm", new DicomOptions());
}
// Create a multi-page Dicom image.
using (DicomImage image = (DicomImage)Image.Create(
new DicomOptions() { Source = new StreamSource(new MemoryStream()) },
100,
100))
{
// Draw something using vector graphics
Graphics graphics = new Graphics(image);
graphics.FillRectangle(new SolidBrush(Color.BlueViolet), image.Bounds);
graphics.FillRectangle(new SolidBrush(Color.Aqua), 10, 20, 50, 20);
graphics.FillEllipse(new SolidBrush(Color.Orange), 30, 50, 70, 30);
// Save the pixels of the drawn image. They are now on the first page of the
Dicom image.
int[] pixels = image.LoadArgb32Pixels(image.Bounds);
// Add a few pages after, making them darker
for (int i = 1; i \< 5; i++)
{
DicomPage page = image.AddPage();
page.SaveArgb32Pixels(page.Bounds, pixels);
page.AdjustBrightness(i \* 30);
}
// Add a few pages in front of the main page, making them brighter
for (int i = 1; i \< 5; i++)
{
DicomPage page = image.InsertPage(0);
page.SaveArgb32Pixels(page.Bounds, pixels);
page.AdjustBrightness(-i \* 30);
}
// Save the created multi-page image to the output file
image.Save("MultiPage.dcm");
}