In This Topic
VintasoftImage.Save method can be used for synchronous saving of image to a file or stream.
Here is a list of supported image encoders:
- BMP
- GIF
- Icon / Cursor
- JBIG2 (VintaSoft JBIG2 .NET Plug-in is necessary)
- JPEG
- JPEG2000 (VintaSoft JPEG2000 .NET Plug-in is necessary)
- PBM, PGM, PPM
- PCX
- PDF (VintaSoft PDF .NET Plug-in is necessary)
- PNG
- SVG
- TGA
- TIFF, BigTIFF
- WEBP
Encoder passed as a method parameter defines saving parameters: save image with annotations, copy TIFF tags, copy EXIF data and much more.
Here is C#/VB.NET code that shows how to save an image as a PNG file:
vsImage.Save("test.png");
Here is C#/VB.NET code that shows how to save image in JPEG format into memory stream, image must be saved with annotations, EXIF metadata and thumbnail:
System.IO.MemoryStream stream = new System.IO.MemoryStream();
Vintasoft.Imaging.Codecs.Encoders.JpegEncoder jpegEncoder =
new Vintasoft.Imaging.Codecs.Encoders.JpegEncoder();
jpegEncoder.AnnotationsFormat = Vintasoft.Imaging.AnnotationsFormat.VintasoftBinary;
jpegEncoder.Settings.CopyExifMetadata = true;
jpegEncoder.Settings.CreateThumbnail = true;
vsImage.Save(stream, jpegEncoder);
Dim stream As New System.IO.MemoryStream()
Dim jpegEncoder As New Vintasoft.Imaging.Codecs.Encoders.JpegEncoder()
jpegEncoder.AnnotationsFormat = Vintasoft.Imaging.AnnotationsFormat.VintasoftBinary
jpegEncoder.Settings.CopyExifMetadata = True
jpegEncoder.Settings.CreateThumbnail = True
vsImage.Save(stream, jpegEncoder)
Here is C#/VB.NET code that shows how to add image to existing TIFF file, image must be saved with WANG annotations, common TIFF and EXIF metadata, GPS metadata must be ignored:
Vintasoft.Imaging.Codecs.Encoders.TiffEncoder tiffEncoder =
new Vintasoft.Imaging.Codecs.Encoders.TiffEncoder(false);
tiffEncoder.AnnotationsFormat = Vintasoft.Imaging.AnnotationsFormat.Wang;
tiffEncoder.Settings.CopyCommonMetadata = true;
tiffEncoder.Settings.CopyExifMetadata = true;
tiffEncoder.Settings.CopyGpsMetadata = false;
vsImage.Save("test.tif", tiffEncoder);
Dim tiffEncoder As New Vintasoft.Imaging.Codecs.Encoders.TiffEncoder(False)
tiffEncoder.AnnotationsFormat = Vintasoft.Imaging.AnnotationsFormat.Wang
tiffEncoder.Settings.CopyCommonMetadata = True
tiffEncoder.Settings.CopyExifMetadata = True
tiffEncoder.Settings.CopyGpsMetadata = False
vsImage.Save("test.tif", tiffEncoder)
Here is C#/VB.NET code that shows how to save image as JPEG file with 10% quality:
Vintasoft.Imaging.Codecs.Encoders.JpegEncoder encoder =
new Vintasoft.Imaging.Codecs.Encoders.JpegEncoder();
encoder.Settings.Quality = 10;
vsImage.Save("myimage.jpg", encoder);
Dim encoder As New Vintasoft.Imaging.Codecs.Encoders.JpegEncoder()
encoder.Settings.Quality = 10
vsImage.Save("myimage.jpg", encoder)
Events
VintasoftImage.Savingevent occurs before image is saving.
VintasoftImage.SavingProgress event occurs when the saving progress of the image is changing.
VintasoftImage.SavingFinished event occurs when image saving process is finished (image may be saved or not be saved).
VintasoftImage.Saved event occurs only if image was saved successfully.
All events of
VintasoftImage class are not thread-safe.