VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging Namespace / VintasoftImage Class
Members Object Syntax Remarks Example Hierarchy Requirements SeeAlso
In This Topic
VintasoftImage Class
In This Topic
Contains information about a raster or vector image.
Object Model
BitmapChannelsFormat ColorSpaceFormat Palette Resolution ImageSourceInfo VintasoftImageMetadata Thumbnail RenderingSettings DecodingSettings VintasoftImage
Syntax
'Declaration

<SerializableAttribute()>
Public NotInheritable Class VintasoftImage

[Serializable()]
public sealed class VintasoftImage

Remarks

Image can be loaded from file, stream or bitmap. The following formats are supported:

  • BMP
  • DICOM (VintaSoft DICOM .NET Plug-in is necessary)
  • DOCX (VintaSoft Office .NET Plug-in is necessary)
  • EMF
  • RAW (DNG, CR2, CRW, NEF, NRW)
  • GIF, animated GIF
  • Icon
  • JBIG2 (VintaSoft JBIG2 .NET Plug-in is necessary)
  • JPEG
  • JPEG-LS
  • JPEG2000 (VintaSoft JPEG2000 .NET Plug-in is necessary)
  • PCX
  • PDF (VintaSoft PDF .NET Plug-in is necessary)
  • PNG
  • TIFF
  • WMF

Important: Only the first image will be accessible if the source image is a multipage file or image. The ImageCollection class must be used if all images of multipage image should be accessed.

The following image parameters can be get without reading image data:
  • width
  • height
  • pixel format
  • bits per pixel
  • palette
  • resolution

Image can be saved to file or stream. The following formats are supported:
  • BMP
  • GIF
  • JBIG2 (VintaSoft JBIG2 .NET Plug-in is necessary)
  • JPEG
  • JPEG2000 (VintaSoft JPEG2000 .NET Plug-in is necessary)
  • PCX
  • PDF (VintaSoft PDF .NET Plug-in is necessary)
  • PNG
  • TIFF

Example

This C#/VB.NET code shows how to get the image info about the image loaded from disk, invert the image, save the image, change pixel format of the image.


Class VintasoftImageExample
    Public Sub GetImageInfo()
        ' load an image from disk
        ' [ do not forget to set your image file path here! ]
        Dim image As New Vintasoft.Imaging.VintasoftImage("c:\original-image.tif")

        ' get the image info
        Dim imageInfo As String = String.Format("Image info: Width={0}, Height={1}, Resolution={2}, PixelFormat={3}", image.Width, image.Height, image.Resolution, image.PixelFormat)

        ' Please notice: image data is still not loaded here because
        ' we have called only metadata info.
        ' So, image data is loading only when it really needs.

        System.Windows.Forms.MessageBox.Show(imageInfo)
    End Sub

    Public Sub InvertImage()
        ' load an image from disk
        ' [ do not forget to set your image file path here! ]
        Dim image As New Vintasoft.Imaging.VintasoftImage("c:\original-image.tif")

        ' invert image
        image.Invert()

        ' save the processed image to the new file
        image.Save("c:\processed-image.tif")
    End Sub

    Public Sub ConvertTo48Bpp()
        ' [ do not forget to set your image file path here! ]
        ' open an existing image
        Dim image As New Vintasoft.Imaging.VintasoftImage("c:\original-image.tif")

        ' create the PixelFormat conversion command
        Dim command As New Vintasoft.Imaging.ImageProcessing.ChangePixelFormatCommand(Vintasoft.Imaging.PixelFormat.Bgr48)
        ' subscribe to progress event
        AddHandler command.Progress, New System.EventHandler(Of Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs)(AddressOf command_Progress)

        Try
            ' execute the command
            command.ExecuteInPlace(image)
        Catch ex As Vintasoft.Imaging.ImageProcessing.ImageProcessingException
            ' show error message if problem occured
            System.Windows.Forms.MessageBox.Show(ex.Message)
            Return
        End Try

        ' save the processed image to the new file
        image.Save("G:\processed-image.tif")
    End Sub

    Private Sub command_Progress(sender As Object, e As Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs)
        ' update progress info using e.Progress property
        ' ...

        ' cancel execution of command using e.Cancel property if necessary
        ' ...
    End Sub
End Class


class VintasoftImageExample
{
    public void GetImageInfo()
    {
        // load an image from disk
        // [ do not forget to set your image file path here! ]
        Vintasoft.Imaging.VintasoftImage image = 
            new Vintasoft.Imaging.VintasoftImage(@"c:\original-image.tif");

        // get the image info
        string imageInfo = string.Format(
            "Image info: Width={0}, Height={1}, Resolution={2}, PixelFormat={3}",
            image.Width,
            image.Height,
            image.Resolution,
            image.PixelFormat);

        // Please notice: image data is still not loaded here because
        // we have called only metadata info.
        // So, image data is loading only when it really needs.

        System.Windows.Forms.MessageBox.Show(imageInfo);
    }

    public void InvertImage()
    {
        // load an image from disk
        // [ do not forget to set your image file path here! ]
        Vintasoft.Imaging.VintasoftImage image = 
            new Vintasoft.Imaging.VintasoftImage(@"c:\original-image.tif");

        // invert image
        image.Invert();

        // save the processed image to the new file
        image.Save(@"c:\processed-image.tif");
    }

    public void ConvertTo48Bpp()
    {
        // [ do not forget to set your image file path here! ]
        // open an existing image
        Vintasoft.Imaging.VintasoftImage image = 
            new Vintasoft.Imaging.VintasoftImage(@"c:\original-image.tif");

        // create the PixelFormat conversion command
        Vintasoft.Imaging.ImageProcessing.ChangePixelFormatCommand command = 
            new Vintasoft.Imaging.ImageProcessing.ChangePixelFormatCommand(
                Vintasoft.Imaging.PixelFormat.Bgr48);
        // subscribe to progress event
        command.Progress += 
            new System.EventHandler<Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs>(command_Progress);

        try
        {
            // execute the command
            command.ExecuteInPlace(image);
        }
        catch (Vintasoft.Imaging.ImageProcessing.ImageProcessingException ex)
        {
            // show error message if problem occured
            System.Windows.Forms.MessageBox.Show(ex.Message);
            return;
        }

        // save the processed image to the new file
        image.Save(@"G:\processed-image.tif");
    }

    void command_Progress(object sender, Vintasoft.Imaging.ImageProcessing.ImageProcessingProgressEventArgs e)
    {
        // update progress info using e.Progress property
        // ...

        // cancel execution of command using e.Cancel property if necessary
        // ...
    }
}

Inheritance Hierarchy

System.Object
   Vintasoft.Imaging.VintasoftImage

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also