Product and Development Musings

ImageMan.Net Version 3.01 Released

2. November 2011 09:54

ImageMan.Net Standard & Document Editions Version 3.01 is now available. This is a maintenance release that also includes a couple of enhancements listed below. The update can be downloaded from the My Products page on our website.

Release Notes - ImageMan.Net - Version 3.01

** Bug
    * [IMN-2] - PDFDecoder creates ImImage with Resolution set to 0
    * [IMN-3] - Installer fails to run toolbox app
    * [IMN-5] - ScaleCommand doesnt set Resolution on processed image
    * [IMN-10] - Exception in ExifParser when a duplicate tag exists
    * [IMN-12] - PdfDecoder class throws NullReference exception from .Load if .Stream property not set, should throw a more meaningful exception
    * [IMN-15] - Memory leak in Deskew Command

** Improvement
    * [IMN-4] - Add missing content to PDF Decoder help
    * [IMN-8] - Update viewer control scollbar thumbs so they show the relative portion of the image displayed
    * [IMN-14] - Minimize number of trial dialog displays at build and runtime

ImageMan.Net Version 3 is now shipping

28. September 2011 10:49

Yes, the next release of our award winning ImageMan.Net Standard & Document edition imaging components is now available. ImageMan.Net Version 3 includes:

  • 32 & 64 bit assemblies
  • Assemblies for .Net 2.0 and .Net 4.0
  • Reading and Writing of EXIF data is supported by the JPG Encoder and Decoder classes
  • New subscription based licensing model
  • Visual Studio 2010 Sample applications in C# and VB.Net
  • Many other new enhancements and performance tweaks



With the release of Version 3 we have also switched to an annual subscription model which will provide developers will all the new major upgrades and updates we develop throughout the year as well as email and forums support. Developers who would like phone based support can also sign up for an optional priority phone support plan.

We've also adopted a new development model with Version 3 which means we'll be providing you with more frequent updates and with major new functionality released over each subscription period. Some of the new features we'll be releasing over the next year includes new searchable PDF support, optional JPBIG encoder and decoder which will provide even better compression for 1 bit images than TIFF group 4 and much more.

Discounted upgrade pricing is available for all current ImageMan.Net developer as well as for users of the ActiveX and DLL components, pricing for the various upgrade options are available after logging in to your My Products page.

A fully functional trial of ImageMan.Net Version 3 can be downloaded from here.

ImageMan.Net V 2.10 is now available

7. March 2011 09:54

Ok, so what can we say, as soon as we shipped V 2.09 we discovered an issue using the Thumbnail control in Visual Studio 2010 on certain systems. We’ve fixed that issue and released Version 2.10.

We sorry for any inconvenience but wanted to eliminate this issue before it affected any other users.

The installation can be downloaded from the My Products page or from the Trial Downloadspage.

Efficiently Convert PDF to Multipage TIF

24. May 2010 08:28

One of our ImageMan.Net customers recently asked us to help him convert a multipage PDF file to a single multipage TIF.  His initial attempts to do so were causing memory issues due the resolution and color depth of the source PDF as well as the approach he was taking. 

Inefficient Approach

The less optimized, but convenient, way to solve this problem would be to load the PDF file into an ImageMan.Net image collection (as a standalone ImageCollection object or part of the Viewer's Images property).  Then you can simply save that collection using one of the many overloaded Save methods.  ImageMan.Net handles appending each image in the collection to a single file.

For example, here's one way to simply save the entire collection to a file called image.tif:




myImageCollection.Save "image.tif"

Or if you are using a Viewer, then you can save the collection using the Viewer's Save method which will loop through the Images property and create a single file called image.tif:




Viewer1.Save "image.tif"

Additionally, these Save methods have overloads that will allow you to specify the start page, the total number of pages and the image encoder to use.

The problem with this approach is that the larger your ImageCollection, the larger the amount of memory your program will use while running.  Our client was running out memory while trying to process the PDF.

Efficient Approach

The most efficient and less memory intensive (and lowest level) way to solve this problem is to make use of the PdfDecoder class to loop through the pages of the source PDF.  With the PdfDecoder you can also modify some of the source PDF's image details including the resolution and color depth.  Then, for each page in the source image, you can create and append to a single output image file using the TifEncoder's Save method.

At the end of this article, I'll provide links to working sample apps that will contain the code to perform the PDF to TIF conversion.  This sample app will cover all of the details on how to properly work with streams to create the decoder and encoder instances.  I'll cover some of the highlights below:

To loop through the pages of the source PDF, you'll need an instance of the PdfDecoder class which will allow you to retrieve the number of pages (using the Pages property) and set the current page (using the Page property).  Then, you can use an instance of the TifEncoder class to append each page to an output file using the Save method:


int totalPageCount = pdfDecoder.Pages;
int currentPageNumber = 0;
while (totalPageCount-- > 0)
    pdfDecoder.Page = currentPageNumber++;
    ImImage tempImage = pdfDecoder.Load(null);
    tifStream.Seek(0, SeekOrigin.Begin);
    tifEncoder.Save(tifStream, tempImage, null);


Dim totalPageCount As Integer = pdfDecoder.Pages
Dim currentPageNumber As Integer = 0
Do While totalPageCount > 0
    pdfDecoder.Page = currentPageNumber
    currentPageNumber += 1  
    Dim tempImage As ImImage = pdfDecoder.Load(Nothing)
    tifStream.Seek(0, SeekOrigin.Begin)
    tifEncoder.Save(tifStream, tempImage, Nothing)
    totalPageCount = totalPageCount - 1

The decoder and encoder classes allow you to perform some very low level operations on images that will help your image processing code become much more efficient.  For more details on these ImageMan.Net classes, please refer to the documentation. 

The following sample apps are available online:

ImageMan.Net and Visual Studio 2010

15. April 2010 08:26

With the release of Visual Studio 2010, some of you are probably eager to start developing new applications on (or porting existing applications to) the .NET Framework 4 and the new IDE.  You can use ImageMan.Net components in Visual Studio 2010 projects that target .Net Framework 4 but you'll need to be aware of one issue. 

According to Microsoft:

The .NET Framework 4 works side-by-side with older Framework versions.  Applications that are based on older versions of the Framework will continue to run on the version targeted by default.

However, the above statement does not hold true when the older versions involve mixed mode assemblies.  ImageMan.Net was developed on .NET Framework 2 and one of the components, DTI.ImageMan.Codecs.dll, is a mixed-mode assembly which does not get properly loaded into the .NET Framework 4 runtime without additional configuration.

Until the ImageMan.Net source is built in .NET Framework 4, you are going to have to apply a slight workaround to get the components to work properly in a .NET Framework 4 assembly.  Here's an example of the type of exception you can expect to see when you do not apply this workaround:


To cause this exception, I created a simple Windows application in Visual Studio 2010.  I dropped ImageMan.Net ThumbnailViewer, Viewer, Annotation and AnnotationToolSrip controls onto the form's design surface.  Then I built and ran the application which displayed the exception dialog above.

To fix this problem, you'll simply need to add the useLegacyV2RuntimeActivationPolicy attribute to the application's config file (app.config) like so:

    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0"/>

Setting this attribute to true will allow a pre-.NET Framework 4 mixed-mode assembly to load in a .NET Framework 4 process.  With this workaround in place, you'll be able to integrate the ImageMan.Net components in your Visual Studio/.NET Framework 4 projects.  We will soon release .NET Framework 4 targeted ImageMan.Net assemblies which will not require you to modify your app.config files.

ImageMan.Net Version 2.05 is available

10. March 2010 08:41

V 2.05 of ImageMan.Net is now available for downloading from the My Products page.

This is a maintenance release that includes the following changes:

  • New Deskew algorithm is faster and more accurate
  • Faster redraw speeds in the ImageMan Viewer control when using iannotations in the document edition
  • Fixed a bug which caused problems when rotating images with an axis > 32K in size
  • Fixed an issue with the DTI.ImageMan.Codecs.dll manifest file which caused a failure when deploying with Clickonce
  • Several other minor fixes

Persisting Annotations: Saving and Branding

19. February 2010 11:43

We recently learned how the Viewer control manages annotation marks during runtime.  Now let's continue our discussion in our series of articles on annotation support in ImageMan.Net Document Edition by highlighting how to persist annotated images after you are done working with them. 

Saving Annotations

The annotation information on an image can be saved in TIFF, JPG or PNG formats. This will happen automatically when an image in the Viewer control has associated annotation information. The annotation information is stored as a separate layer of the image.

So, if you want to share or continue working with an annotated image save it as a TIFF, JPG or PNG file.  If you want to load an image with the annotation information in the proprietary ImageMan.Net format in another TIFF viewer the annotation information will not be displayed.  (In an upcoming post, we will learn how to create annotated images with a common set of annotations that can be shared with other TIFF viewers.)

We'll now add the ability to save our annotations in the sample application we built in the last few posts (Visual Studio 2008 source code: C# source, VB.Net source).

  • Open IMAnnotate1.sln for C# (or IMAnnotate1VB.sln fo VB.Net) in Visual Studio 2005 or 2008 (which ever you used last time)
  • Open Form1 class in design view
  • Drag and drop a SaveFileDialog control onto the form:


  • Add a new menu item under the File menu item and call it Save.:


  • Automatically add events to this submenu item by double-clicking to let Visual Studio autogenerate the event method.
  • Now, add this code to open the Save File dialog:


private void saveToolStripMenuItem_Click(object sender, EventArgs e)
    saveFileDialog1.Filter = RegisteredEncoders.GetFilterString();
    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
        annotation1.SaveInWangFormat = false;


Private Sub SaveToolStripMenuItem_Click( _
    ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles SaveToolStripMenuItem.Click
    SaveFileDialog1.Filter = RegisteredEncoders.GetFilterString()
    If SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
        Annotation1.SaveInWangFormat = False
    End If
End Sub

First we generate a list of available file types to allow the user to use and set that as the filter for the SaveFileDialog control.  Then, if the user selected a valid filename and location, we save the image using the given filename.  Notice the SaveInWangFormat property of the Annotation object? Let's hold off on that until the next topic.

  • So now run the application (by clicking F5, for instance)
  • Add a few annotation marks onto the default (white) image
  • Save that image to a known location as either a TIFF, JPG or PNG file type
  • Close the application
  • Run it again
  • Open the previously saved image
  • You should now still be able to move, edit and otherwise manipulate the previous marks

Note: If you open the file in the Windows Picture and Fax Viewer, for instance, you will not see the annotated marks.

Branding Annotations

If you need to permanently add the annotation information to the image you can use the annotation objects Brand() method to burn the annotations onto the image. Once you do this, however, you can no longer manipulate the annotations as before.

Branding is done at the image's color depth. So if you have color marks and a black and white image. Either increase the color depth of the underlying image, or understand that the color branded marks will appear differently.

  • Add another menu item on the toolstrip (under the File menu item) and call it Brand


  • Create the code behind and add the following code:


private void brandToolStripMenuItem_Click(object sender, EventArgs e)
    // Brand the current image
    // Clear all existing marks
    // Refresh the viewer


Private Sub BrandToolStripMenuItem_Click( _
    ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles BrandToolStripMenuItem.Click
    ' Brand the current image
    ' Clear all existing marks
    ' Refresh the viewer
End Sub
  • Run the application
  • Add a few annotation marks onto the default (white) image
  • Brand the image using the Brand menu option
  • Now try to manipulate the current marks and notice that you can't (they aren't marks now; they are part of the image)
  • Add some new marks
  • Save that image to a known location as either a TIFF, JPG or PNG file type
  • Close the application
  • Run it again
  • Open the previously saved image
  • You should now still be able to move, edit and otherwise manipulate the new marks but the branded marks are not editable any longer

Save this project since we will continue to build on it next time for a discussion on persisting common annotations that are compatible with other TIFF viewer and (many) annotation editors.

Annotations in ImageMan.NET Document Edition

5. January 2010 12:08

Today we are going to kick off a series of blog posts highlighting some of the great new features in our latest version of ImageMan: ImageMan.Net Document Edition.  This first post will introduce you to the annotation features you can use to add text and drawings to images or documents. 

The Document Edition includes a rich set of annotation objects including:

    • Rectangle
    • Ellipse
    • Line
    • Polygon
    • Highlight
    • String
    • Freehand Line
    • Bezier Curve
    • Pie Shape
    • Arc
    • Sticky Note
    • Image
    • Redaction
    • Overlay
    • Text Stamp
    • Custom Mark

You can add multiple annotation objects to an image.  Once added, you can modify, move, resize and remove them easily.  We'll discuss persisting, protecting and encrypting annotated images in upcoming blog posts.  We'll also cover implementing annotation support programmatically soon, but for starters, we'll go over the Annotation control, which is the core of annotation support in ImageMan.Net, as well as the Annotation ToolStrip.

Test Driving the Annotation Features

Let's build a simple image viewer with annotation support.  I'm assuming you've already installed at least the trial version of the ImageMan.Net Document Edition.

  1. Start Visual Studio.Net (2005/2008)
  2. Create a new Windows Forms Application project (in C# or VB.Net)
  3. Name it IMAnnotate1
  4. Add the following controls to the design surface of Form1:
    - MenuStrip
  5. Add the following ImageMan.Net controls to the design surface of Form1:
    - Viewer, Annotation, Annotation ToolStrip
  6. In the Properties window, set the following properties for viewer1:
    - Dock: Fill
  7. Set the following properties for annotation1:
    - Viewer: viewer1
    - ToolStrip: annotationToolstrip1
  8. Save your work

Adding the Design Surface

If you run the application we've just created, you'll notice that the Annotation ToolStrip is pre-populated with buttons you can use to easily work with the full set of annotation objects:


Our next step is to add a design surface.  We have two options here: we can add code to go out and retrieve an existing image and load it into the Viewer or we can create a new image.  For ease of use, let's go with the latter approach.

  1. Open Form1 in code view
  2. Add a reference to DTI.ImageMan:


using DTI.ImageMan;

[Visual Basic]

Imports DTI.ImageMan
  1. In the Form1 Constructor (after the InitializeComponent() method), add this code to create the default design surface:


    new ImImage(800, 1100, PixelFormat.Format24bppRgb, Color.White));

[Visual Basic]

    New ImImage(800, 1100, PixelFormat.Format24bppRgb, Color.White))

Working with the Annotation ToolStrip

Now we've got a design surface where we can add and manipulate annotation marks.  Let's add a few marks from the Annotation ToolStrip.

  1. Select the Rectangle button
  2. Left click and drag on the design surface to create a rectangle annotation mark

Notice that when you select an annotation tool on the Annotation ToolStrip, additional formatting tool buttons are dynamically added:


The visible formatting options will change depending on the annotation tool selected. For the Rectangle annotation tool, you can modify the following properties:

  • Fore Color
  • Back Color
  • Translucent
  • Brush
  • Pen Width
  • Corner Radius
  • Filled

Working with the Annotation Marks

Once a mark has been added to an image, you can perform various actions on it.  Marks can be:

  • selected
  • dragged
  • dropped
  • reordered
  • formatted
  • moved
  • resized (for most annotation marks)
  • deleted
  • copied
  • cut
  1. Click on the Select tool on the Annotation ToolStrip:


  1. Select the rectangle mark on the design surface by clicking anywhere inside it
  2. On the ToolStrip, select the Back Color button
  3. Select a color in the Color Dialog and click OK button
  4. On the ToolStrip, select the Pen Width button
  5. Enter a pen width of 3 and click the OK button


Working with the Context Menu

An alternative way to create and format annotation objects is to use the right click context menu. 

  1. Right click on the design surface
  2. Select the Tools menu option
  3. Select the Note annotation tool
  4. Drag a note mark onto the design surface
  5. Type some text in the note mark


If you want to hide the context menu, you just have to set the ShowContextMenu property on the Annotation object to false:


annotation1.ShowContextMenu = false;

[Visual Basic]

annotation1.ShowContextMenu = False

The next article on this topic will cover saving and branding your annotated images.

Drag and Drop with the ImageMan.NET WinForms Controls

22. December 2009 12:11

The ImageMan.NET Windows Forms controls make it easy to implement drag and drop functionality in your own applications.  To showcase this feature, lets extend one of the VS.NET 2008 Thumbnail control samples (TestThumbCol for C# or TestThumbColVb for VB.NET) that ships with ImageMan.NET.  This code will also work in Visual Studio.NET 2005.

We will add the ability for a user to select one or more image files from Windows Explorer and drop them on to the Viewer control.  The images will then be added to the Thumbnail Browser control and one of the images will be opened in the Viewer.

  • Run Visual Studio.NET 2008
  • Open the solution file found under:

For C#:
C:\Program Files\ImageMan.Net V2\Visual Studio 2008 Samples\C#\TestThumbCol\TestThumbCol.sln


C:\Program Files\ImageMan.Net V2\Visual Studio 2008 Samples\VB\TestThumbColVb\TestThumbColVB.sln

  • Open Form1 in design view
  • Select the Viewer control
  • In the Properties window, set AllowDrop to True:


  • Open the Events list for the Viewer control and double click on the DragDrop event to have Visual Studio.NET automatically create the event:


  • Return to the design view and double click on the DragOver event to have Visual Studio.NET automatically generate the event:


  • Staying in code view, let's add some code to the DragDrop event which will add the selected files to the Viewer's image collection.  Because the Thumbnail Browser is synchronized with the Viewer's image collection (in the Form's constructor), the Thumbnail Browser will also be updated.  In the DragDrop event, add the following code:

For C#:

private void thumbNail1_DragDrop(object sender, DragEventArgs e)
    string[] fileNames = (string[])e.Data.GetData(DataFormats.FileDrop);

    // handle each file passed as needed
    foreach (string fileName in fileNames)
        // Open each image and add to collection


Private Sub viewer1_DragDrop(ByVal sender As System.Object, ByVal e _
    As System.Windows.Forms.DragEventArgs) Handles viewer1.DragDrop
    Dim fileNames As String() = _
        DirectCast(e.Data.GetData(DataFormats.FileDrop), String())

    ' handle each file passed as needed
    For Each fileName As String In fileNames
        ' Open each image and add to collection
End Sub
  • To add the appropriate visual feedback to the user interface, update the DragOver event with the code shown below:

For C#:

private void thumbNail1_DragOver(object sender, DragEventArgs e)
    if (e.Data.GetDataPresent(DataFormats.FileDrop))
        e.Effect = DragDropEffects.Copy;
        e.Effect = DragDropEffects.None;


Private Sub viewer1_DragOver(ByVal sender As System.Object, ByVal e _
    As System.Windows.Forms.DragEventArgs) Handles viewer1.DragOver
    If e.Data.GetDataPresent(DataFormats.FileDrop) Then
        e.Effect = DragDropEffects.Copy
        e.Effect = DragDropEffects.None
    End If
End Sub
  • Build the application and give it a test run
  • Open Windows Explorer and navigate to a folder that contains images
  • Select one or more images and drag them on to the Viewer control.  Notice that the cursor will change indicating that you are allowed to drop the files on that control surface.
  • Drop the files on to the Viewer control and notice that the Thumbnail Browser updates to include those files and that one of the files will be displayed in the Viewer:


You can follow the steps outlined below to add similar functionality to the Thumbnail Browser control as well.  This implementation of drag and drop is consistent with the default Windows controls set and makes it easy for you add the user interactions your users have come to expect with desktop applications.

ImageMan.Net Version 1.73 Available

19. November 2009 04:11

V 1.73 of ImageMan.Net is now available for downloading from the My Products page.

This is a maintenance release that includes the following changes:

  • Memory leak in decoders
  • TIFF LZW compression for 24 bit continous tone images improved
  • TifEncoder may invert passed image data for 1 bit images
  • Scale of thumbnail images is incorrect
Log in