Hello,
Regarding the article below, do we have the ability to change the quality and type of image that is captured from the cell range that is referenced by a picture using .formula?
Thank You,
-Andy
Hello,
Regarding the article below, do we have the ability to change the quality and type of image that is captured from the cell range that is referenced by a picture using .formula?
Thank You,
-Andy
Hello,
When using a picture with a formula (linked picture) in Aspose.Cells, the rendering quality of that image during conversion to formats like PDF or HTML is controlled via the ImageOrPrintOptions class.
While the linked picture itself is a dynamic object within the Excel file, you can specify the resolution and image format when rendering the worksheet or the specific shape to an image. By using the HorizontalResolution, VerticalResolution, and Quality properties of the ImageOrPrintOptions object, you can significantly enhance the output quality.
If you are saving the workbook to a static format, please ensure you configure these options before the rendering process to achieve the desired clarity for your cell-referenced pictures.
@weissa
Could you explain more about your your need?
If the formula of picture is set, the image is dynamic. Aspose.Cells updates image with calling Shape.UpdateSelectedValue() and now the resolution of generated image is fixed. Do you want to change the resolution of generated image?
I found what I needed. Since I’m converting to PDF and the customer is complaining about the image quality I was able to discover these settings which I think may help. In this specific case the customer has a dynamic image in the worksheet that is driven using an INDEX + MATCH technique in a named range. The named range is the target in a picture box which automatically displays a screenshot of the referenced cell, containing one of the images in the lookup. I was concerned that the quality of that screenshot may not be configurable when converting to PDF. I 'll see if these PDF Image quality settings help.
var options = new PdfSaveOptions
{
OptimizationType = lowQualityPdf ? PdfOptimizationType.MinimumSize : PdfOptimizationType.Standard,
});
};
options.SetImageResample(lowQualityPdf ? 150 : 220, lowQualityPdf ? 50 : 100);
Thank You,
-Andy
@weissa
Please try these parameters first to see if they are valid. If there are any further questions, please share the template file you provided. We will check as soon as possible.
I am concerned that if the data in the cells associated with the image changes, the image will need to be regenerated. Currently, Aspose. Cell’s Shape.UupdateSelectedValue is re imaged at a fixed resolution.
You’re concern was accurate.
Using the attached Excel file:
You’ll see in the attached PDF file that the image on the first page is blurry, whereas the source image on page 2 is crisp. If we were able to configure the resolution for this image quality at open time, or more globally we would leverage that here.
Dynamic Logo.zip (140.3 KB)
Thank You,
-Andy
Thank you for the follow-up and for clarifying your requirements regarding the image resolution.
We understand that the current fixed resolution for dynamic pictures (linked images) is causing blurriness in your PDF output. Our development team is currently investigating how to expose configuration options that would allow you to adjust the resolution or quality for these specific dynamic objects during the rendering process.
We have logged this behavior for further analysis to ensure that the quality of images generated from cell formulas meets your expectations. We will keep you updated on the progress of this investigation and notify you as soon as a solution or a workaround becomes available.
@weissa
Thank you for providing the sample file.
After thorough investigation, we discovered that once the value is set to “Image 2,” the resulting picture points to a PNG file. As PNG images are raster‑based, some loss of quality is inevitable when they are scaled up or down.
At present, the image associated with “Image 2” can be replaced with a pure EMF file to avoid this issue.
Furthermore, we plan to add targeted optimizations for this functionality in a future development cycle.
We sincerely apologize for any inconvenience this may cause to your work.
Please contact us immediately if you have any other questions.