VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging Namespace / VintasoftImage Class
Members Example



In This Topic
    VintasoftImage Class
    In This Topic
    Contains information about a raster or vector image.
    Object Model
    VintasoftImage ClassBitmapChannelsFormat ClassColorSpaceFormat ClassDecodingSettings ClassVintasoftImageMetadata ClassPalette ClassRenderingSettings ClassResolution StructureImageSourceInfo ClassThumbnail Class
    Syntax
    'Declaration
     
    <LicenseProviderAttribute(Vintasoft.Imaging.VintasoftLicenseProvider)>
    <EditorAttribute(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="9., Vintasoft.Imaging, Version=8.6.1.1, Culture=neutral, PublicKeyToken=153caf29a10d2e31")>
    <SerializableAttribute()>
    Public NotInheritable Class VintasoftImage 
    [LicenseProvider(Vintasoft.Imaging.VintasoftLicenseProvider)]
    [Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="9., Vintasoft.Imaging, Version=8.6.1.1, Culture=neutral, PublicKeyToken=153caf29a10d2e31")]
    [Serializable()]
    public sealed class VintasoftImage 
    [LicenseProvider(Vintasoft.Imaging.VintasoftLicenseProvider)]
    [Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="9., Vintasoft.Imaging, Version=8.6.1.1, Culture=neutral, PublicKeyToken=153caf29a10d2e31")]
    [Serializable()]
    public __gc __sealed class VintasoftImage 
    [LicenseProvider(Vintasoft.Imaging.VintasoftLicenseProvider)]
    [Editor(EditorBaseTypeName="System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", EditorTypeName="9., Vintasoft.Imaging, Version=8.6.1.1, Culture=neutral, PublicKeyToken=153caf29a10d2e31")]
    [Serializable()]
    public ref class VintasoftImage sealed 
    Remarks
    Image can be loaded from file, stream or bitmap. The following formats are supported:
    • BMP
    • DICOM
    • EMF
    • RAW (DNG, CR2, CRW, NEF, NRW)
    • GIF, animated GIF
    • Icon
    • JBIG2, multipage JBIG2 (VintaSoft JBIG2 .NET Plug-in is necessary)
    • JPEG
    • JPEG-LS
    • JPEG2000 (VintaSoft JPEG2000 .NET Plug-in is necessary)
    • PCX
    • PDF, multipage PDF (VintaSoft PDF .NET Plug-in is necessary)
    • PNG
    • TIFF, multipage 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, multipage JBIG2 (VintaSoft JBIG2 .NET Plug-in is necessary)
    • JPEG
    • JPEG2000 (VintaSoft JPEG2000 .NET Plug-in is necessary)
    • PCX
    • PDF, multipage PDF (VintaSoft PDF .NET Plug-in is necessary)
    • PNG
    • TIFF, multipage TIFF
    Example
    This example 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: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also