Updating a Multipage Tiff

Questions, comments and suggestions concerning VintaSoft Imaging .NET SDK.

Moderator: Alex

Post Reply
Posts: 1
Joined: Thu Jun 10, 2010 3:08 am

Updating a Multipage Tiff

Post by Douglas911 » Thu Jun 10, 2010 3:20 am

I really struggled with this but I found that the following code worked for me.
Create a windows form that has an Imageviewer1 component and an OpenFileDialog1
I have three buttons. Load, Change, Save.
Some of the code I hand typed, but I believe I have it correct.

Hope this helps

Douglas Shonley
Computer Help
Sturgis, SD


Code: Select all

Imports System.Windows.Forms
Imports System.Drawing
Imports System.IO
Imports Vintasoft.Imaging
Imports Vintasoft.Imaging.Codecs
Imports Vintasoft.Imaging.Codecs.Tiff

Public Class frmTesting
   Dim vTiff As New TiffFile
   Dim vCurrentFileName as String
   Dim vTempFile2 as String = "C:\Temp\Tempfile2.tiff"

 Private Sub butLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butLoad.Click
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            vCurrentFileName = OpenFileDialog1.FileName
            Exit Sub
        End If

        'Load into vTiff
        vTiff = New TiffFile(vCurrentFileName)

        'Move Images into ImageViewer
        For x As Integer = 0 To vTiff.Pages.Count - 1

    End Sub

    Private Sub butChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butChange.Click

    End Sub

    Private Sub butSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butSave.Click

        'Clear out present vTiff

        butSave.Text = "Updating Tiff"

        'Move images from ImageViewer1 to vTiff
        For x As Integer = 0 To ImageViewer1.Images.Count - 1

        butSave.Text = "Saving"

        'Save vTiff to a temporary file

        butSave.Text = "Disposing"

        'Clean out the tiff

        'Clean out the ImageViewer

        butSave.Text = "Copying"

        'Copy the tempfile over the top of original file
        My.Computer.FileSystem.CopyFile(vTempFile2, vCurrentFileName, True)

        butSave.Text = "Done"

    End Sub
End Class

Site Admin
Posts: 1577
Joined: Thu Jul 10, 2008 2:21 pm

Re: Updating a Multipage Tiff

Post by Alex » Thu Jun 10, 2010 2:55 pm

Hello Douglas,

Your code is correct but not optimal!

Version 4.2 of VintaSoftImaging.NET SDK is released today. This version now allows to save processed and/or annotated images back to the source using ImageCollection, please see our ImageViewer and Annotation Demos.

Best regards, Alexander

Post Reply