Framework / Web Forms / Response Types / Image Response Type

Image Response Type
This topic applies only for non-AJAX modes.
 Overview
The image response type is represented by the NImageResponse class deriving from NResponse (the base of all response objects). When the chart generates an image response it will send an img HTML tag pointing to a temporary image file generated on the server.
 Modifying The Image Type

The type of the generated image is defined by the object contained in the ImageFormat property of the NImageResponse object. It can be one of the following:

 

Class Image Type Available options
NBitmapImageFormat Windows Bitmap Bits per pixel
NGifImageFormat GIF Bits per pixel
NJpegImageFormat JPEG Bits per pixel, quality
NPngImageFormat PNG Bits per pixel
NTiffImageFormat TIFF Bits per pixel
NSvgImageFormat SVG Compress, EmbedImagesInSvg, EmbeddedImageFormat
AddSvgHeader, EnableInteractivity, CustomScript

 

The following code will change the default response type to true color JPEG with quality parameter set to 90 percent:

C#
Copy Code
NImageResponse imageResponse = new NImageResponse();

NJpegImageFormat jpegImageFormat = new NJpegImageFormat();
jpegImageFormat.Quality = 90;
jpegImageFormat.PixelFormat = PixelFormat.Format32bppArgb;
imageResponse.ImageFormat = jpegImageFormat;

//[theComponent] is a valid instance of either NChartControl or NDrawingView
[theComponent].ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse;
Visual Basic
Copy Code
Dim imageResponse As New NImageResponse
Dim jpegImageFormat As New NJpegImageFormat

jpegImageFormat.Quality = 90
jpegImageFormat.PixelFormat = PixelFormat.Format32bppArgb
imageResponse.ImageFormat = jpegImageFormat

'[theComponent] is a valid instance of either NChartControl or NDrawingView
[theComponent].ServerSettings.BrowserResponseSettings.DefaultResponse = imageResponse