Ikram ul Haq October 7, 20150 Comments

Export PSD Layer to Raster Image and 3D AutoCAD Images to PDF with Aspose.Imaging for .NET 3.1.0

Export PSD Layer to Raster Image and 3D AutoCAD Images to PDF with Aspose.Imaging for .NET 3.1.0

October 7, 2015
Share on FacebookTweet about this on TwitterShare on LinkedIn

We are pleased to announce the release of Aspose.Imaging for .NET 3.1.0. This release contains two very useful features namely exporting PSD Layer to Raster Image and exporting 3D AutoCAD Images to PDF.

Export PSD Layer to Raster Image

Aspose.Imaging for .NET API has introduced the functionality to export layer(s) in a PSD file to Raster image. Save method of the Layer class can be used to export a layer in a PSD file to raster image. Here is the code to Export the PSD Layer to Raster Image.


//Load an existing PSD file as image.
using (Image image = Image.Load(dataDir + "sample.psd"))
{
    // Cast into PSD image.
    var psdImage = (FileFormats.Psd.PsdImage)image;

    // Create an instance of ImageOptions class.
    var pngOptions = new ImageOptions.PngOptions();
    pngOptions.ColorType = FileFormats.Png.PngColorType.TruecolorWithAlpha;

    // iterate through the layers in the PSD.
    for (int i = 0; i < psdImage.Layers.Length; i++)
    {
        // Access a layer and save it as PNG image.
        psdImage.Layers[i].Save(dataDir + "layer-" + i +".png", pngOptions);
    }
}

Export 3D AutoCAD Images to PDF

Aspose.Imaging for .NET API has introduced the functionality to export 3D AutoCAD images to PDF. Save method of the CadImage class, 3D AutoCAD Images (DxF) can be used to export to PDF format. You have to use the Aspose.Imaging.ImageOptions.TypeOfEntities.Entities3D class to activate the 3D settings. Here is the code to Export the 3D AutoCAD Images to PDF.


//Load an existing DxF file as CAD image.
using (CadImage cadImage = (CadImage)Image.Load(dataDir + "conic_pyramid.dxf"))
{
    // Create an instance of CadRasterizationOptions class to set the preferences.
    CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
    rasterizationOptions.PageWidth = 500;
    rasterizationOptions.PageHeight = 500;

    // Set/Activate the 3D option.
    rasterizationOptions.TypeOfEntities = TypeOfEntities.Entities3D;
    rasterizationOptions.Layouts = new string[] { "Model" };
    
    // Create an instance of PdfOptions class.
    PdfOptions pdfOptions = new PdfOptions();
    pdfOptions.VectorRasterizationOptions = rasterizationOptions;

    // Save the CAD image into PDF format.
    cadImage.Save(dataDir + "output.pdf", pdfOptions);
}

Enhancements

Fix to an exception "Cannot open an image. The image file format may be not supported at the moment. at Image.load" while loading DWG file format has also been taken care. Some problems were noticed while exporting DWG to PDF format, JPEG image get distorted after saving with CMYK colorspace setting and quality of the image decreases while re-sizing the image. All such issues have been fixed.

  • Fixed: ExifData and Comment properties in JpegImage class are always set to null after reading a JPEG image that contains these data.

  • Fixed: ImageLoadException: Cannot process loading further due to incorrect file format structure. Index was out of range. Must be non-negative and less than the size of the collection, while loading DWG.

  • Fixed: Image quality (Sharpness) decreases while resizing the image.

  • Fixed: Converting DWG to raster image formats Tiff renders in blank image with no Layout specified.

  • Fixed: ImageLoadException: Unable to read file.

  • Fixed: System.OverflowException: Arithmetic operation resulted in an overflow, at Image.Resize.

  • Fixed: Conversion of DWG to PDF generated a huge file in size.

Many reported bug fixes have also been included. Please refer to the release notes of Aspose.Imaging for .NET 3.1.0 for a full view of improvements along with sample code snippets for newly added features. If you are planning to upgrade the API to the latest revision, we strongly suggest you to check the Public API Change section to know what has been changed in the public API since your current version.

Aspose.Imaging for .Net Resources

The resources, you may need to accomplish your tasks:

As always we appreciate your feedback so if you ever have anything to tell us about this release or anything else, please head to the Aspose.Imaging forum for a chat.

Leave a comment

Posted inAspose.Total Product Family, Aspose.Imaging Product Family
 

Related Articles