C# Imaging Library
C# Raster - Image Save Options in C#.NET
How to save image(s) addition options with C# XImage.Raster SDK
There are a series of settings for saving. Every output format has their own special save options. The table at the end of this section will explain these parameters in detail.
How to save, export TIFF BMP, PNG raster images with options applied using C#?
Download XImage.Raster C# imaging library
Install C# library to save, convert, export TIFF, BMP, PNG, JPG images with options specified in .NET applications
Step by Step Tutorial
Free Download
To save RasterImage object with option just need three steps:
Create a SaveOption object.
Set the corresponding arguments
Pass the object to the Save method.
Here we will explain a sample C# code to save an image with saving options applied.
Create a SaveOption object to specify the image saving options.
Specify the saving image format as PNG
Apply the PNG image properties, including Filter, Inerlaced, and Level
Create a RasterImage object with an image loaded.
Call method Save() to save image with options applied.
SaveOption options = new SaveOption();
options.ImageFormat = RasterEdge.XImage.Raster.ImageFormat.PNG;
options.Png.Filter = PNGFilter.PAETH;
options.Png.Interlaced = true ;
options.Png.Level = PNGCompressLevel.LEVEL9;
RasterImage image = new RasterImage( "sample-image.png" );
image.Save( "sample-image-saved-with-options.png" , options);
List of image saving options
General Image Saving Options
ImageFormat Specify the target format that image need to encode to
ThumbnailSize the size of the output, set this option will save the RasterImage object as a thumbnail
UseEmbeddedColorManagement if use the embedded color management
RenderIntent set the render intent for output file
TargetProfileName the path of color profile
Image Formats Specified Options:
SaveOption.Png
Filter filtering the data before compression
Interlaced if save the png file in interlaced format. Turn on it if there is a slow internet connection.
Level compression level
Strategy compression strategy
TransparencyColor pick a color form the image, and make it transparent
TransparencyMatch colors within this distance are considered equal.
SaveOption.Tif
Compression set compression for output tif file
ColorSpace set color space for output tif file
MultiPage if save to a multipage tif file, otherwise only the first page of the file will be saved.
RowsPerStip set the number of rows per strip
SaveOption.Bmp
Compression set the compression for output bmp file
SaveOption.Jpeg
Progressive if save jpeg file in progressed format. Turn on it if there is a slow internet connection.
OptimizedHuffman if use the optimized Huffman codes during encoding instead of using default Huffman codes
SaveToGray if save the output jpeg file to gray
ColorSpace set the output jpeg file's color space
Quality set compression level
SubSampleType specify sub sample type for jpeg encoder, use default compress quality 85
SmoothImage if smooth the output jpeg file
SaveOption.Gif
Interlaced if save gif file in interlaced format
TransparencyColor pick a color from color palette and define it as a transparent color
TransparencyMatch colors within this distance are considered equal
Version set output gif's version. note:87a not support animate delays nor transparent background colors
SaveOption.Jp2
SaveToGray if save the jp2 file to gray scale
PSNR set the Peak Signal to Noise Ratio(DB)
CompressRate set jp2 file's compression rate
ProgressOrder set jp2 file's progress order
TileWidth set jp2 file's tile width
TileHeigth set jp2 file's tile height
Lossless if save jp2 file in lossless format