Sheet to Image rendering - Distorted transparent PNG image captured

Our application captures transparent PNG images for use in email distribution. This is because some recipients use dark background vs. others with a light background.

Aspose seems to be distorting the image when a transparent background is used, but not when a fill is used for the cells.

Please see the following screenshots and attached solution for a demo of the issue.

Transparent:

image.png (758 Bytes)

Fill:

image.png (948 Bytes)

Solution:

AsposeDistortedImageIssue.zip (5.3 MB)

@mhopkins,
I have tried this scenario using the latest version but could not observe this issue. You may please try this scenario with the latest version and share your feedback. The output generated with the latest version is attached here for your reference.

fill.png (44.2 KB)
transparent.png (38.2 KB)

Ahsan,

I just tried with the 21.9 Nuget package and I’m still seeing the problem. Is there a newer unrelease version where this is fixed?

Thanks,

Matt

@mhopkins
I have also used NuGet package manager to download the latest version. Please share your environment details where this issue is tested. Also do you find this issue in the images shared here? If yes, please identify for our reference.

The images you posted earlier look great and not distorted at all.

Excel Information

image.png (1.9 KB)

Device name QBIT-5K5CWT2
Processor Intel® Xeon® E-2176M CPU @ 2.70GHz 2.71 GHz
Installed RAM 32.0 GB (31.7 GB usable)
System type 64-bit operating system, x64-based processor
Pen and touch No pen or touch input is available for this display
Edition Windows 10 Enterprise
Version 20H2
Installed on ‎11/‎16/‎2020
OS build 19042.1110
Experience Windows Feature Experience Pack 120.2212.3530.0

Visual Studio Info

Microsoft Visual Studio Professional 2019
Version 16.8.3
VisualStudio.16.Release/16.8.3+30804.86
Microsoft .NET Framework
Version 4.8.04084

Installed Version: Professional

Add-in Express for Microsoft Office and .NET v9.5.4661
Add-in Express for Microsoft Office and .NET. For more information about Add-in Express™, see the following website: http://www.add-in-express.com. (C) Add-in Express Ltd. All rights reserved.

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

ASA Service Provider 1.0

ASP.NET and Web Tools 2019 16.8.554.20160
ASP.NET and Web Tools 2019

ASP.NET Core Razor Language Services 16.1.0.2052803+84e121f1403378489b842e1797df2f3f5a49ac3c
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2019 16.8.554.20160
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.8.554.20160
Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.6.1000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.8.554.20160
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.6.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter 16.8.20241.2
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

JetBrains ReSharper 2021.1.2 Build 211.0.20210420.181229
JetBrains ReSharper package for Microsoft Visual Studio. For more information about ReSharper, visit ReSharper: The Visual Studio Extension for .NET Developers by JetBrains. Copyright © 2021 JetBrains, Inc.

Microsoft Azure HDInsight Azure Node 2.6.1000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.6.1000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.6.1000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30924.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.1.113+g422d40002e.RR
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Node.js Tools 1.5.20902.1 Commit Hash:b474efcb6f92db52a8f8e2e6a8cb9648476885cc
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 5.8.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio 16.0.30502.00
Microsoft Office Developer Tools for Visual Studio

Productivity Power Tools 2017/2019 16.0
Installs the individual extensions of Productivity Power Tools 2017/2019

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Python 16.8.20241.2
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Conda support 16.8.20241.2
Conda support for Python projects.

Python - Django support 16.8.20241.2
Provides templates and integration for the Django web framework.

Python - IronPython support 16.8.20241.2
Provides templates and integration for IronPython-based projects.

Python - Profiling support 16.8.20241.2
Profiling support for Python projects.

SonarLint for Visual Studio 4.38.0.36876
SonarLint is an extension to your favorite IDE that provides on-the-fly feedback to developers on new bugs and quality issues injected into their code.

SQL Server Data Tools 16.0.62010.06180
Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 16.0.21016.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
Microsoft Visual F# Tools

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0
Visual Studio Tools for Kubernetes

Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

@mhopkins,
Thank you for sharing the environment details. We have observed the issue and logged it in our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSNETCORE-268 - Distorted image created when a transparent background is used

Thanks for the update.

-Matt

@mhopkins

When you draw a text to a tranparent image, the text will be burred. Please add set AntiAlias for text.
So the ImageOrPrintOptions will be:

new ImageOrPrintOptions
{
    OnePagePerSheet = true,
    ImageType = Aspose.Cells.Drawing.ImageType.Png,
    HorizontalResolution = 200,
    VerticalResolution = 200,
    Transparent = true,
    TextRenderingHint = TextRenderingHint.AntiAlias,
}

@Peyton.Xu ,

Thank you for the “hint”. This works great.

I see that the default value for TextRenderingHint is set to SystemDefault. What does Aspose look for in the OS, Windows 10 in my case, when determining what the system default is?

Thanks again,

Matt

@mhopkins,
We have noted your query and will share our feedback soon.

@mhopkins

We pass the TextRenderingHint in ImageOrPrintOptions to System.Drawing.Graphics.TextRenderingHint(the default value is SystemDefault) while generating the output image.