Image generated with poor quality

Hello Team,

We generating image using Aspose.Imaging latest version in .NET application. When we zoom in generated image, text in image is not displaying properly. It’s like image is pixelated. How can we overcome this problem using Aspose.Imaging. For you ref, we have attached sample application and generated image.
SampleApplication - (8.2 MB)

Would you mind to share your input image and the code which produce poor quality results.

We have already shared code in this zip.


We’ve reviewed your ASP,NET MVC application project, but did not find input image and working code, which produces attached output.png (1.9 KB)

Feel free to provide them to let us investigate the issue.

I have reattached sample application. In that, I have written code in Index method of HomeController. Due to size limit, I have removed dll from sample application. When you run application, test.png image will be generated in ImagesOutput folder. We have used image from SourceImg folder as source image. (8.3 MB)

Following code from your code snippet:

using (Aspose.Imaging.FileFormats.Png.PngImage newImage = (Aspose.Imaging.FileFormats.Png.PngImage)Image.Create(options, width + 48, headerHeight + 16))
                    int stitchedHeight = 0;
                    foreach (string imagePath in imagePaths)
                        using (RasterImage rasterImage = (RasterImage)Image.Load(imagePath))
                            rasterImage.SetResolution(300, 300);
                            Rectangle bounds;
                            if (stitchedHeight == 0)
                                bounds = new Rectangle(0, stitchedHeight, rasterImage.Width, rasterImage.Height);
                                bounds = new Rectangle(24, stitchedHeight, rasterImage.Width, rasterImage.Height);
                            stitchedHeight += stitchedHeight == 0 ? rasterImage.Height + 16 : rasterImage.Height;

                            newImage.SaveArgb32Pixels(bounds, rasterImage.LoadArgb32Pixels(rasterImage.Bounds));

produces wrong results as pixels manipulations are not supported in evaluation mode.

In licensed mode expected result is following : test.png (1.1 KB)

Feel free to request the temporary license, if needed.

We have license and the output image shared in zip file is generated by using license. Due to security season we haven’t shared license file in zip. Even when you zoom in test.png shared by you, you can notice quality issue.


You may achieve better quality :
a) using another font (i.e. Arial)
b) using

TextRenderingHint = Aspose.Imaging.TextRenderingHint.ClearTypeGridFit,

Expected result :test.png (1.0 KB)

Hi Team,

We have made changes of font to Arail and set TextRenderingHint to ClearTypeGridFit but it looks like there is no notable improvement in image quality after and before. Please refer attached image. Please suggest other approach if you have to generate best quality image. Also, our requirement is to generate image using Proxima Nova font so can we know why we can’t get better quality image if we use Proxima Nova font?

Comparison.jpg (42.7 KB)

@siriussynoptek, please take a look at provided example and results. Here used your image and text lines were drawn on it. Think, result looks not pixelated. Also please note, that this is raster format and you are not able to achieve best zoom results than in vectors.

//Create an instance of BmpOptions and set its various properties
            Aspose.Imaging.ImageOptions.PngOptions pngOptions = new Aspose.Imaging.ImageOptions.PngOptions();
            pngOptions.ColorType = PngColorType.TruecolorWithAlpha;

            //Create an instance of FileCreateSource and assign it as Source for the instance of BmpOptions
            //Second Boolean parameter determines if the file to be created IsTemporal or not
            pngOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"resultImaging.png", false);

            Font font1 = new Font("Proxima-Nova", 30);
            Font font2 = new Font("Arial", 30);
            //Create an instance of Image and initialize it with instance of BmpOptions by calling Create method
            using (Aspose.Imaging.Image imageNew = Aspose.Imaging.Image.Create(pngOptions, 800, 100))
                using (PngImage header = (PngImage)Image.Load("header.png")
                    //do some image processing
                    Graphics gr = new Graphics(imageNew);
                    gr.DrawImage(header, new Point(0, 0));
                    SizeF size = gr.MeasureString(DrawString, font1, Aspose.Imaging.SizeF.Empty, new StringFormat());
                    SizeF size2 = gr.MeasureString(DrawString, font2, Aspose.Imaging.SizeF.Empty, new StringFormat());

                    gr.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                    gr.SmoothingMode = SmoothingMode.HighQuality;
                        new Aspose.Imaging.Brushes.SolidBrush(Color.Black),
                        new PointF(0, 0));
                        new Aspose.Imaging.Brushes.SolidBrush(Color.Black),
                        new PointF(0, 50));
                    // save all changes

Result: Dropbox - resultImaging.png - Simplify your life


We have applied code snippet given by you and observed that no major quality improvement in generated image. Is there any compression take place when we resize image or create image using Aspose.Imaging due to that poor quality image generated?

@siriussynoptek, As wrote before, text is rasterized on raster image. Here are result obtained using Photoshop with Proxima Nova font and Arial Dropbox - resultPhotoshop.png - Simplify your life and here are results using Aspose.Imaging with 0 compression level for png Dropbox - resultImagingNoCompressionLevel.png - Simplify your life As you can see scaling gives worth result in both cases, but results looks similar. Aspose.Imaging provides using of Png compression by CompressionLevel option in PngOptions. It can be from 0 to 9. 0 - no compression. Please provide results that does not pixelate if you can, so that we can investigate more. As wrote below, to avoid pixelation on scaling you can try use vectors with fonts, for example svg.

Hi Team,

It is not possible to use only vector images for the functionality as our client have large amount of images in raster and vector formats. So as per the requirement we need to maintain image quality for both the formats. Please provide your inputs, how to achieve best quality result for above requirement?

Please note that we have a hard requirement for this quality concern. Please consider it and let us know.

@siriussynoptek, You can embed source raster image in svg or pdf. And your text will scale.

Can you please elaborate it in details?

please, see example:

           //create graphics
           EmfRecorderGraphics2D graphics = new EmfRecorderGraphics2D(new Rectangle(0, 0, 50000, 50000), new Size(5000, 5000), new Size(1000, 1000));
               //Source raster image
               using (Image rasterImage = Image.Load(@"D:\1.png"))
                   graphics.DrawImage(rasterImage as RasterImage, new Point(0,0));

               Font font = new Font("Arial", 48, FontStyle.Bold | FontStyle.Underline);

               //Text with font, color, position
               graphics.DrawString("Hello world", font, Color.Blue, 150, 200);

               //Generate emf image
               using (EmfImage image = graphics.EndRecording())
                   //image.Save(@"D:\1.emf"); //save to emf format
                   //image.Save(@"D:\1.pdf", new PdfOptions()); //save to pdf format
                   image.Save(@"D:\1.svg", new SvgOptions()); //save to svg format

More details here

Hello Team,

As our requirement is to generate image into raster format(source image extension), we don’t want to save generated image in vector format. Please suggest us how can we achieve best quality image in raster format only?

@siriussynoptek Please write in what way you are not satisfied with the vector format?

Hello Team,

As mentioned earlier, our most of source images are in raster format and our requirement is to generate branded image by adding text and using existing source image and generated branded image format should be same as source image format. so we want to improve quality of generated raster format branded image.


If you are confused by the quality of the text of raster images in the Jpeg format, change the Jpeg quality to a higher one. (In your example, this is exactly the problem)
As already discussed with you in another thread.