HomeAdd Ons Accusoft's ImageGear .NET Beefs Up the High End of Graphics Programming
Accusoft's ImageGear .NET Beefs Up the High End of Graphics Programming ByBob Reselman 2004-08-30
Article Rating: / 0
Rate This Article:
Add This Article To:
ImageGear .NET supports the creation, analysis, and manipulation of image files. It offers a lot for NET programmers who want to become serious players in the graphics programming arena.
More information is being conveyed via detailed graphical data today than at any time in our history. And, as Internet becomes a ubiquitous part of our world culture, even more of this information is delivered as images generated on-demand and on-the-fly, particularly in regard to mapmaking and image recognition.
A programmer's ability to create powerful graphical programs quickly is no longer a "nice skill to have."” It is a professional necessity, especially if you do Internet programming in general and .NET programming in particular. As a result, the software development tool space is becoming filled with many powerful programming tools that make graphics programming a more thoughtful, less laborious endeavor.
ADVERTISEMENT
Accusoft Corporation recently released such a tool in its ImageGear line, ImageGear .NET. ImageGear .NET supports the creation, analysis, and manipulation of image files in about two
dozen formats. The company advertises high speed display capabilities, a full set of printing functions, and support for TWAIN compliant devices. (TWAIN is a standard that allows image
acquisition devices, such as scanners and digital cameras, to interact directly with imaging software applications.) In addition, ImageGear .NET has an add-on allows you create programs that can read and write PDF files.
ImageGear .NET has six namespaces, with many objects in each namespace. Thus, you can count on becoming very good friends with the Visual Studio Object Browser when you use this product. I had to use the Object Browser's Search field more than once to find the namespace of a particular object. The Help system is well integrated into Visual Studio. ImageGear .NET did a very good job of supporting the point, click and F1 documentation retrieval when I clicked on the method name in code. Given the sheer breadth of objects in ImageGear .NET, F1 support was a lifesaver.
Learning From The Sample Apps
ImageGear .NET ships with samples that demonstrate how to use ImageGear .NET to create WinForms in C# and WebForms apps in VB and C#. I am very pleased to report that all the sample code worked! There is nothing more frustrating than spending hours trying to learn a product from sample code, only to find out that the programming is flaky.
The ASP.NET example demonstrates a form that allows you to upload an image and then zoom in and out of that image. The VB Winform example is a tutorial that allows you to load an image,
rotate it and zoom in and out; it's not really rocket science in the world of graphics programming, but adequate enough for the beginning graphics programmer.
The C# examples are much more extensive. The graphics metadata example is very impressive. It shows you how to get images from disk or Web and how to analyzed selected image. (Please see Figure 1).
Figure 1: ImageGear .NET allows you to do very sophisticated image manipulation and inspection of various file formats' metadata.
Other examples show you how to manipulate display, work with image processing and in different color spaces, do multiple image merging, and acquire images from TWAIN devices. The code samples show you how to work with contrast, image blends, color channels, image sizing, rotation, and a lot more.
The world of graphics programming has its own language and techniques that you'll need to know to do advanced work. Once you start spending time with ImageGear, you will find yourself using the Glossary that ships in the help files. It speaks well of Accusoft that they understand that the ImageGear .NET tool is only as good as the conceptual knowledge of the programmer using it. The glossary and outside reading suggested in the help files are a great addition.
Working with the Code
To get some hands-on knowledge, I set out to create a small WebForm project that uploads a file in JPG format and saves it to GIF format on the server's disk, using VB under ASP.NET. Setting up the code was easy for me because I know enough C# to be dangerous. I simply hijacked the sample code, translated it to VB and tweaked it to suit my needs. The code is below.
Private Sub cmdConvert_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles cmdConvert.Click
ImageGear.Core.ImGearLicense.SetSolutionName("AccuSoft 1-40-14")
Dim upload As HtmlInputFile = FindControl("upload")
Dim stream As Stream = upload.PostedFile.InputStream
Dim page As ImageGear.Core.ImGearPage
Dim savingFormat As ImageGear.Formats.ImGearSavingFormats
page = ImageGear.Formats.ImGearFileFormats.LoadPage(stream, 0)
savingFormat = ImageGear.Formats.ImGearSavingFormats.GIF
Dim memStream As New MemoryStream
ImageGear.Formats.ImGearFileFormats.SavePage(page, memStream, 0,_
Formats.ImGearSavingModes.OVERWRITE, savingFormat)
Dim filStream As New FileStream("C:\projects\accusoft\test.gif",_
FileMode.OpenOrCreate)
memStream.WriteTo(filStream)
filStream.Close()
End Sub
As I mentioned earlier, I had to use the Object Browser more than once to find out namespaces for required objects. Also, the hour I spent reviewing the ImageGear documentation proved to be useful in terms of understanding the meaning and manipulation of multi-page images, the support of which is certainly one of ImageGear .NET's strengths.
Sadly, when I tried to save the JPG image to a GIF I got an incompatible file format error. Yet, when I changed the save format to PNG, my code worked easily. I've seen this error before in code that tries to convert files into GIF format using Windows GDI+. Some products allow you to easily avoid this error. Some do not. It seems that ImageGear .NET was in the latter camp of the latter. (However, there is .NET code out on the Internet that shows you how
to do graphic file format conversion and saving for the common file formats.) Of course, using ImageGear .NET solely to convert files is an underutilization; this tool is more for high-end image manipulation.
In addition to the .NET assemblies, the setup program installs sample code for C# and VB WinForms, as well as ASP.NET code using WebForms. The help files are adequate, though they do fall a little outside of the Help style format familiar to most Visual Studio developers. The code in the help files is in C#, which puts VB developers at a disadvantage. Methods signatures are documented, but there are no examples of how to use a given method. It seems that Accusoft is asking the developer to refer to the sample apps to get the details of how to use the product.
Drawing The Bottom Line
ImageGear .NET sells for $1,500. This may seem a bit pricey. However, the price covers royalty free, unlimited distribution of the product on a per developer basis. This means that one developer can make as many applications as she wants, using ImageGear .NET objects, and distribute these applications to whomever she likes, regardless of whether the application is targeted for the desktop or for web servers. Also, the purchase price includes one year of on-line, ticket based technical support for ImageGear .NET.
ImageGear .NET is not flash-in-the-pan code. Accusoft has been around since 1985, making everything from data visualization tools to medical imaging software. With partners such as HP, Borland and IBM, they bring a certain reliability to the table. Yes, the VB weenie in me wishes that they provided more VB code demos and samples in the help files, but overall the product offers a lot for the .NET programmer who wants to become a serious player in the
graphics programming arena.