Technical FAQs

Question

When using OCR in ImageGear .NET, is there any way to distinguish between a capital/uppercase letter O and the number 0?

Answer

Not without context or a font that makes the difference clear (such as one with a slashed 0). ImageGear will properly recognize Oliver and 1530 as containing O and 0, respectively, but cannot reliably distinguish it when letters and numbers are mixed. That is, ImageGear may not reliably distinguish between 1ABO0F3 and 1AB0OF3.

Question

Why do I get a “File Format Unrecognized” exception when trying to load a PDF document in ImageGear .NET?

Answer

You will need to set up your project to include PDF support if you want to work with PDF documents. Add a reference to ImageGear24.Formats.Pdf (if you’re using another version of ImageGear, make sure you’re adding the correct reference). Add the following line of code where you specify other resources:

using ImageGear.Formats.PDF;

Add the following lines of code before you begin working with PDFs:

ImGearFileFormats.Filters.Insert(0, ImGearPDF.CreatePDFFormat());
ImGearPDF.Initialize();

The documentation page linked here shows how to add PDF support to a project.

Question

Why do I get a “File Format Unrecognized” exception when trying to load a PDF document in ImageGear .NET?

Answer

You will need to set up your project to include PDF support if you want to work with PDF documents. Add a reference to ImageGear24.Formats.Pdf (if you’re using another version of ImageGear, make sure you’re adding the correct reference). Add the following line of code where you specify other resources:

using ImageGear.Formats.PDF;

Add the following lines of code before you begin working with PDFs:

ImGearFileFormats.Filters.Insert(0, ImGearPDF.CreatePDFFormat());
ImGearPDF.Initialize();

The documentation page linked here shows how to add PDF support to a project.

Question

How do I use a Network Drive path for Image and ART storage in my ImageGear .NET web application?

Answer

In an ImageGear .NET web application, you have to define the location of the images and annotations directory in the storageRootPath and artStorageRootPath configuration property.
In the current version of ImageGear .NET, the storageRootPath and artStorageRootPath do not work with a network drive path \\SERVER-NAME\sharefilename.

The workaround for this would be to create a Symbolic link from a local directory to the network drive directory.

  • To create a symbolic link: Open “Command Prompt” as Administrator and type in > mklink /d "local path" \\SERVER-NAME\sharefilename
  • Pass in the path of the symbolic link as image or art storage root path in your web.config: storageRootPath="local path" artStorageRootPath="local path"

Image compression has become such a ubiquitous aspect of the digital world that the average person doesn’t give it much thought. Even when they encounter textbook compression problems, such as running out of space for photos on their phones, waiting on a slow-loading webpage, or working with an overly pixelated image, they may not consider how effective compression techniques could resolve these issues.

Today’s software developers, by contrast, spend a lot of time thinking about how to incorporate better compression solutions into their applications. That’s why they frequently turn to image compression SDKs to help their end users better manage large and highly-detailed image files.

The Enduring Need for Image Compression

Although advancements in hard drive technology and easily scalable cloud storage have reduced many traditional data management concerns, large image files can still pose significant challenges. Many organizations that can’t utilize cloud storage options for compliance reasons or find the cost of those platforms prohibitively high. 

While they may be able to add more on-premises storage easily enough, this option can also quickly become quite costly. Companies often need to procure much more storage than they may need on a day-to-day basis in order to meet redundancy requirements. Scaling physical storage also locks firms into burdensome equipment refresh cycles.

But simply storing images is only part of the challenge of data management. Large files are more difficult to move, even if an organization has a customized solution in place. If images can’t be shared quickly and easily through a secure platform, users may turn to riskier third-party applications.

Image compression alleviates these problems by reducing the overall size of image files. By compressing image files, organizations can maximize their storage potential and share files more easily. Image compression can also improve website and application performance by reducing the time it takes to load images. 

Although there are many different methods of compressing images, they all involve algorithms that use a variety of shortcuts to reduce the overall size of pixel data. In some instances, compression involves the elimination of image data, which can degrade the image quality and make it impossible to return to its original size (lossy or irreversible compression). Other techniques retain the original image data, but can’t achieve the same level of compression (lossless or reversible compression). 

Image Compression SDKs and Your Applications

While there are many compression options available in commercial imaging software, organizations often need the ability to compress image files within their core business applications without any external dependencies. Opening an image file with another program not only takes additional time and disrupts efficient workflow, but it also creates the potential for security risks and version confusion.

Consider, for instance, a medical provider that needs to send a high-resolution MRI scan to another provider. If the file is too large to deliver electronically, someone may try to get around the problem by using another program to compress the scan and then send it as an attachment over email or share it through a cloud platform. Suddenly, the confidential image file has been accessed by potentially vulnerable third-party applications, which creates a serious compliance issue. To make matters worse, the compressed image may not be associated with the patient’s file in the EHR system. And that’s not even getting in the question of whether or not the compression technique used damaged the image integrity!

An image compression SDK like ImageGear allows developers to integrate the ability to compress and convert image files into their applications without compromising security, efficiency, or quality. Optimized, standards-based compression libraries with support of formats like TIFF, PDF, PDF/A, JPEG 2000, JPEG, and DICOM deliver fast compression/decompression capabilities while ensuring that images remain high quality. 

The primary advantage of integrating image compression capabilities directly into an application is the lack of third-party dependencies. This is crucial for software that is gathering and managing image files because it doesn’t cause any workflow disruptions. With an image compression SDK integration, image files can be shrunk down to more manageable sizes programmatically, which aids significantly in automated processes. Since the images are being compressed entirely within the application, it’s also easier to maintain strict version and access control throughout the life cycle of the file.

Image Compression SDKs vs Open Source Solutions

Many developers turn to open source compression libraries when looking to integrate image compression features into their applications. While this often seems like an easy, low cost solution, open source codecs can lead to unforeseen problems over time. Since many of them are not actively maintained, troublesome bugs can go unresolved and security gaps can create serious privacy risks.

One infamous example of this problem involved the widely used “Cornell Codec,” one of the first open source libraries that supported lossless JPEG compression. Developed in 1994, it was quickly adopted by many healthcare applications that needed to compress high-resolution medical images like MIRIs, CT scans, and X-Rays. 

Unfortunately, the codec had a problem. When it compressed images into DICOM files (the industry standard used in medical imaging applications), it produced an error that made them unreadable when they were decompressed. Since the Cornell Codec was an open source solution embedded into numerous applications, the problem went unresolved for many years until Accusoft developed a code based workaround for our customers.

By choosing a well-supported image compression SDK like ImageGear for their application’s compression needs, developers can rest easier knowing that they’re deploying a tried and true solution that won’t create unexpected problems for their customers. Another benefit of a comprehensive image compression SDK is that it will provide a variety of compression libraries that can accommodate almost any file type and use case. ImageGear, for example, supports more than a dozen unique image compression types, including JPEG (lossy/lossless/progressive), RAW, ASCII, and Deflate.

ImageGear: More Than an Image Compression SDK

Image compression is just one of ImageGear’s many powerful document and image processing features. A versatile code-based solution, ImageGear allows developers to quickly integrate image conversion and cleanup features to their application along with editing, annotation, viewing, scanning, and printing capabilities. With support for a huge number of today’s leading document and image file formats as well as medical imaging support with ImageGear Medical, this SDK toolkit delivers the functionality developers need to get their applications to market faster. See what ImageGear can do for your application today by downloading a free trial.

Wait, playing video games for charity? Is that even a thing?

Not only is it a thing, but it’s an exciting fundraising effort Accusoft has embraced through our “Champion a Charity” program. Throughout the year, we encourage employees to sponsor a charity of their choosing and solicit donations from their coworkers. We then match a portion of those donations as part of our effort to give back to our community.

For the fourth straight year, Accusoft employees took part in Extra Life’s annual Game Day fundraiser to contribute funds to Johns Hopkins All Children’s Hospital in St. Petersburg, Florida.

What Is Extra Life?

Established in 2008, Extra Life is a charity program that works with Children’s Miracle Network Hospitals to raise funds for local children’s hospitals by playing games. Gamers sign up to contribute and receive donations as they take part in a gaming marathon with friends and coworkers. Although the Extra Life events can be held year round, each year the organization designates a worldwide Game Day to bring thousands of participants together for an exciting and healing experience.

Since its inception, Extra Life has raised over $70 million to support sick and injured children receiving care throughout Children’s Miracle Network Hospitals. The network consists of 170 member hospitals that provide 32 million treatments across the US and Canada. These hospitals treat every child who comes through their doors, regardless of the family’s ability to pay, so they rely on charitable donations to continue to deliver the best care possible.

“I think it’s a wonderful thing that they help people not have to worry about how they’re going to pay to keep their children in the kind of treatment that they need,” said Accusoft marketing manager Ariana Tsouris. “No one should have to worry about their kid being sick or worried about not being able to take care of their kid because they can’t pay for their treatment.” 

Extra Life game events encompass all sorts of games, from the simplest card and board games to the very latest video game releases. Many participants stream their games on Twitch or hold large events at their workplace to raise awareness and encourage matching contributions.

The Accusoft Extra Life Team

Accusoft has participated in Extra Life Game Day since 2017, raising over $14,000 in the process. For 2020, we assembled a team of 13 eager gamers with the hope of pushing our total over $18,000. As part of Accusoft’s commitment to giving back to the community, we match team member donations and make additional donations on behalf of the top scorers in each game.

“It’s fun, but also it’s a really good way to give to the community and people who are in need,” software engineer Colby Butler said. “Sometimes it’s hard to do that, but this is kind of a no-brainer, easy way to have some fun and do some good in the community.”

Some team members were taking part in Extra Life for the first time. UI/UX strategist Rob Barry donated last year, but this time he decided to insert a coin to participate himself: “I have close friends who have gone through some difficult medical struggles with their children, so I try to budget throughout the year to give to causes like Extra Life. Becoming a father for the first time gave me a whole new perspective on how the program can help, though, so this year I decided to sign up to help the team exceed its goals.”

There were some familiar faces on this year’s team as well. “This was my sixth year participating in Extra Life’s Game Day,” said product manager Mark Hansen. “For me, it was a great opportunity to take something I love, video gaming, and put it together with a great charity.” But Extra Life is about more than just fun and games for Mark. “The cause is really important to me because my niece has unfortunately spent a great deal of time in All Children’s Hospital, more than any child should have to. This is a great opportunity to give back to those hospitals.”

Extra Life 2020: Remote Edition

In the past, we’ve held our Game Day event at the Accusoft offices, but that wasn’t possible this year due to COVID-19 restrictions. Luckily, as a software development company, we had a few cheat codes handy to get around that particular obstacle.

Our resident Extra Life organizer, senior software engineer Michael Irigoyen, set out to solve the problem by creating the Accusoft Game Center, a virtual arcade that the entire team could access remotely.

“It was a big undertaking,” Michael said. “We not only had to get the games running and be able to support multiple players, but also integrate a community scoreboard so everybody could see who was in the lead for each game. The whole idea was to keep people interested and bring attention to the charity so they would want to donate.”

Fortunately, Michael had some assistance along the way. “Jamison Prianos helped to reverse engineer the arcade games and Kyla Kolb did a lot of bug hunting to make sure everything looked and ran great for the big day.”

Final Results

When it was all said and done, the Accusoft Extra Life team didn’t just set a new high score. We shattered our previous donation record! The team raised a total of $14,550, an astounding 70% increase from 2019’s total. Even more impressive, 62 Accusoft employees made donations, a 17% increase from last year. 

“Each year I’m blown away by the generosity of my teammates,” said Ariana, a three-year participant on the Accusoft Extra Life team. “Even with all the uncertainty in 2020, we raised an incredible amount of money for an equally incredible cause and it’s fantastic.”

Michael couldn’t be happier with the results: “We were absolutely floored by the support and generosity of our team. Just knowing that we can make that kind of impact is really empowering because these kids don’t deserve to be facing the things that they are.”

Looking Ahead

This year’s successful Game Day event has pushed Accusoft’s overall Extra Life donation total to nearly $30,000 since 2017. While the team is looking forward to next year’s fundraiser, there are still plenty of opportunities to continue raising funds before then.

“The Accusoft Game Center isn’t going anywhere,” Michael said. “Some of us may continue to fundraise throughout the rest of the year, so our total contributions might still go up!”

It’s a sentiment that truly embodies the spirit of Accusoft’s Champion a Charity program. Community outreach remains a key element of our mission to make the world in which we live and work a better place. 

Looking to work for an innovative company that’s dedicated to making a real difference? Check out our careers page to learn more about our values and culture.

Question

ImageGear .NET v24.6 added support for viewing PDF documents with XFA content. I’m using v24.8, and upon trying to open an XFA PDF, I get a SEHException for some reason…

SEHException

Why might this be happening?

Answer

One reason could be because you need to execute the following lines after initializing the PDF component, and prior to loading an XFA PDF:

// Allow opening of PDF documents that contain XFA form data.
IImGearFormat pdfFormat = ImGearFileFormats.Filters.Get(ImGearFormats.PDF);
pdfFormat.Parameters.GetByName("XFAAllowed").Value = true;

This will enable XFA PDFs to be opened by the ImageGear .NET toolkit.

Question

I want to re-arrange the page order of a PDF. I’ve tried the following…

var page = imGearDocument.Pages[indx].Clone();

imGearDocument.Pages.RemoveAt(indx); //// Exception: "One or more pages are in use and could not be deleted."

imGearDocument.Pages.Insert(newIndx, page);

But an exception is thrown. Somehow, even though the page was cloned, the exception states that the page can’t be removed because it’s still in use.

What am I doing wrong here?

Answer

If you’re using an older version of ImageGear .NET, you may run into this exception when you clone the page. Some of the resources between the original and the clone are still shared, which is why this happens.

Starting with ImageGear .NET v24.8, this no longer happens, and the above code should work fine.

If you still need to use the earlier version, you can use the InsertPages method instead.

Question

In ImageGear, why am I running into AccessViolationExceptions when I run my application in parallel?

Answer

This issue can sometimes occur if ImGearPDF is being initialized earlier in the application. In order to use ImGearPDF in a multi-threaded program, it needs to be initialized on a per-thread basis. For example, if you have something like this:

ImGearPDF.Initialize();
Parallel.For(...)
{ 
    // OCR code
}
ImGearPDF.Terminate();

Change it to this:

Parallel.For(...)
{
    ImGearPDF.Initialize();
    // OCR code
    ImGearPDF.Terminate();
}

The same logic applies to other ImageGear classes, such as ImGearPage instances or the ImGearRecognition class – you should create one instance of each class per thread, rather than creating a single instance and accessing it across threads. In the case of the ImGearRecognition class, you’ll have to use the createUnique parameter to make that possible e.g.:

ImGearRecognition recEngine = ImGearRecognition(true);

instead of

ImGearRecognition recEngine = ImGearRecognition();
Question

How do I remove XMP Data from my image using ImageGear .NET?

Answer

When removing XMP data in ImageGear, the simplest way to do this is to set the XMP Metadata node to null, like so:

ImGearSimplifiedMetadata.Initialize(); 
doc.Metadata.XMP = new ImGearXMPMetadataRoot();

Or, you can traverse through the metadata tree and remove each node from the tree:

// Example code. Not thoroughly tested
private static void RemoveXmp(ImGearMetadataTree tree)
{
ArrayList toRemove = new ArrayList();
foreach (ImGearMetadataNode node in tree.Children)
{
    if (node is ImGearMetadataTree)
        RemoveXmp((ImGearMetadataTree)node);

    if (node.Format != ImGearMetadataFormats.XMP)
        continue;

    toRemove.Add(node);
}

foreach (ImGearMetadataNode node in toRemove)
    tree.Children.Remove(node);
}