Saving correct transparent images from PDF

Hello, Aspose team!

Our team tries to find way saving images with transparent background from PDF, but images saving with the black background now. We use Aspose.Pdf with 17.12.0.0 version.

Example pdf:
test15.pdf (351.8 KB)

How save images with transparent background?

Sample our code:

public void ProcessDocument(Document pdfDocument)
{
Page page;
for (int i = 1; i <= pdfDocument.Pages.Count; i++)
{
page = pdfDocument.Pages[i];
List images = new List();

            ImagePlacementAbsorber abs = new ImagePlacementAbsorber();

            page.Accept(abs);
            for (int j = 1; j <= abs.ImagePlacements.Count; j++)
            {

                ImagePlacement absImagePlacement = abs.ImagePlacements[j];
                ImageOptions image = new ImageOptions
                {
                    Rectangle = absImagePlacement.Rectangle.ToRect(),
                    PageNumber = page.Number,
                    Height = absImagePlacement.Image.Height,
                    Width = absImagePlacement.Image.Width,
                    ImageIndex = j,
                    Image = absImagePlacement.Image,
                };

                images.Add(image);
            }

            foreach (var imageOptions in images)
            {
                var pathToImage = @"C:\temp\" + Guid.NewGuid().ToString();
                using (var fileStream = File.Create(pathToImage))
                {
                    imageOptions.Image.Save(fileStream);
                }
            }
        }
    }

namespace Lineslip.Services.Processing.PDF.Models
{
using Aspose.Pdf;

public class ImageOptions
{
    public string PathToImage { get; set; }

    public System.Drawing.Rectangle Rectangle { get; set; }

    public int PageNumber { get; set; }

    public int Height { get; set; }

    public int Width { get; set; }

    public int ImageIndex { get; set; }

    public XImage Image { get; set; }

    public System.Drawing.Image GrayscaledImage { get; set; }
}

}

@asimahin

Thank you for contacting support.

I have worked with the data shared by you and have been able to reproduce the issue in our environment. A ticket with ID PDFNET-43930 has been logged in our issue management system for further investigation and resolution. The issue ID has been linked with this thread so that you will receive notification as soon as the issue is resolved.

However, as a workaround, you may extract images from any PDF file by converting it to an XML file, as explained in this documentation article. All embedded files including fonts, images etc will be extracted efficiently. I have attached the screenshot of extracted transparent image for your kind reference. Perfect.JPG

We are sorry for the inconvenience.

Is there an update to this issue ? I tried using Extract Images using PdfExtractor|Aspose.PDF for .NET as a workaround but the images are not keeping their transparency.

@mulderspm

We are afraid that the earlier logged ticket has not been yet resolved. However, we have recorded your concerns and revived the ticket. As soon as some progress is made towards its resolution, we will inform you in this forum thread. We apologize for the inconvenience.