We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to improve generated image quality with aspose imaging

Hi Support,

We have implemented functionality in which we are adding company branding into the image and allow users to download the same. To implement this functionality. We have base image with subject specific content and graphics after that we are adding branded image such as header, footer and add some text on the image and then allow user to download the image. We have implemented this functionality using aspose.imaging and it is working fine. But we are facing quality related issue to be more specific the text gets pixelized(TextQuality.png) and base image quality also gets degraded(please note that we are resizing base image using aspose). We have also raised ticket during development phase(Ticket for reference).

We also want to explore some other option as well by which we can improve overall quality on the output image. Below are the points that we want to check feasibility in aspose.imaging or any other aspose product.

  • Discuss how to convert raster type (PNG & JPG) to SVG images
  • How can we improve quality of raster type (PNG & JPG) in case we need to resize it
  • If it is possible to convert raster image into branded image then how we can do that

We want to discuss and demonstrate all existing functionality to get suggestion for discussed improvements. Can we schedule call with your technical team and work on it?

TextQuality.png (58.7 KB)

Please let us know your inputs on the same.

@siriussynoptek,

how to convert raster type (PNG & JPG) to SVG images

using (var image = Image.Load("rasterImage.png"))
{
      image.Save("vectorImage.svg", new SvgOptions());
}

*But it should be understood that the raster image will remain a raster image, but embedded in a vector

How can we improve quality of raster type (PNG & JPG) in case we need to resize it

Try to choose a more suitable a resize type

If it is possible to convert raster image into branded image then how we can do that

Please let me know what is wrong with your code.

Here are all the possible solutions to the problem: Image generated with poor quality
To what has been discussed, it is difficult for us to add something new.

Can we schedule call with your technical team and work on it?

Unfortunately, according to Free Support Policies, all discussions are held exclusively on the forum

Thanks for quick response,

We will try code snippets you have shared with us and let you know in case of further question arise.

As far as on call support is concerns, we have also purchased paid support with us. So hopefully which would be allowed us to have a on call support to discuss our issues. Please let us know your thoughts on this.

Thanks in advance.

@siriussynoptek
Thank you for coming back and for your willingness to use our products and services.

Please review https://helpdesk.aspose.com/kb/index.php to be confident regarding paid support conditions and avoid wrong expectations regarding the usage of this service.

In few words - paid support is about priorities to service the requests, within the same support workflow.

Hello Support,

We have checked provided code to convert png/jpg into SVG images.but we haven’t found improvement in quality. we have also used suitable resize type as suggested. is there any available features which we can use to improve quality.

Is it possible to create blank image and add text to specific position with proper padding, margin and alignment.

Thanks.

@siriussynoptek You can create a blank image, add text, paste some other image into it and resize it, using the following code snippet. The CubicConvolution resize produces a quality result, very similar to the one you can get from Adobe Photoshop.
As for the conversion to the SVG format, it is explained in one of the previous replies.

var inputFileName = "cat.jpg";
var outputFileName = "cat.jpg.png";

PngOptions pngOptions = new PngOptions();
pngOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(outputFileName, false);

using (var image = Aspose.Imaging.Image.Load(inputFileName))
{
    using (RasterImage imageBlank = (RasterImage)Image.Create(pngOptions, image.Width, image.Height + 300))
    {
        //Create and initialize an instance of Graphics class
        Aspose.Imaging.Graphics graphics = new Aspose.Imaging.Graphics(imageBlank);

        //Clear Graphics surface
        graphics.Clear(Aspose.Imaging.Color.White);
        graphics.DrawImage(image, new Point(0, 150));
        graphics.DrawString("HEADER", 
            new Font("Arial", 48, FontStyle.Bold),
            new SolidBrush(Aspose.Imaging.Color.Black), 
            new PointF(image.Width / 2 - 100, 50));
        graphics.DrawString("FOOTER", 
            new Font("Arial", 24, FontStyle.Italic),
            new SolidBrush(Aspose.Imaging.Color.Black),
            new PointF(image.Width / 2 - 50, image.Height + 200));

        imageBlank.Resize(image.Width / 3, (image.Height + 300) / 3, ResizeType.CubicConvolution);
        imageBlank.Save();
    }
}

Here are the examples of the resize results produced by Aspose.Imaging with CubicConvolution resize type
cat.jpg — Aspose.Imaging.jpg (39.1 KB)
and by Adobe Photoshop with automatic resize type
cat.jpg — Adobe Photoshop.jpg (42.8 KB)