Tag Archives: WIA

Creating a VBA WIA Image Manipulation Class Module

Over the years, I’ve published numerous articles about 1 off WIA functions:

and many others.

I decided that I explore taking all of these functions and transform them into a Class module.
 
Continue reading

Auto Orienting Images via VBA

Have you ever loaded an image into say an Access Image control, or ‘legacy’ Web Browser control, only to have the image display flipped and/or rotated like:

when if you open it in most image software, preview it in explorer, open it in most modern day web browsers it displays just fine like:

and wondered what was going on exactly.

This happens because of something called the Exif Orientation tag, which is a piece of metadata stored inside many JPEG images by cameras.

Basically, when you take a photo, your camera records how you were holding the device (upright, sideways, upside down, etc.) and saves this information in the Exif Orientation tag (this is hidden information that is stored with the image). Instead of actually rotating the pixels in the image file, the camera just notes the orientation in the metadata. Some programs, like Windows Explorer, read this tag and automatically display the image in the correct orientation. Other programs might ignore the Exif Orientation tag and show the image as it is physically stored, which can result in the image appearing sideways or upside down
 
Continue reading

Convert Any Angle Into A Cardinal Angle => 0, 90, 180 and 270

While working on the same project in which I came to need:

I perfected the function to actually output cardinal angle since my actual need was to produce angles to work with WIA’s rotate filter.

So I was after cardinal value like: 0, 90, 180, 270.
 
Continue reading

VBA – WIA – Check If A File Is In An Acceptable Format

Over the years, I’ve released a number of posts and functions for working with images using WIA:

so on and so forth!

Continue reading

VBA – WIA – Convert Image to Grayscale

Convert To Grayscale

Today, I thought I’d add to my library of image manipulation functions

and I set out to see if there was a way, using WIA (Microsoft Windows Image Acquisition Library), to convert an image to black and white, well to be more precise to convert it to grayscale.

I originally searched high and low and could find nothing already done that I could utilize in any way. Oh there’s stuff out there for .net, C/C++, … just not VBA and certainly not relating to using WIA to perform the conversion. So I decided to try and create something myself (I have to stop doing this).

Not knowing a thing about the difference between a color image and a grayscale image (from a technical, pixel, standpoint) I set out to do some research.

I asked in specialized forums, but my questions went unanswered for days, even weeks. It took me a considerable amount of time as I didn’t have the proper terminology for performing searches, but eventually, I found what I was after!

Now, I was ready to build a VBA function to perform the conversion. After many attempts, I manage to create a function!
 
Continue reading

VBA – WIA – FilterInfos and Filter Properties

 

I’ve written a couple articles about using WIA to work with images:

and many more.

In the past, I’ve been asked how can I determine which filters are available and which properties each filter possesses since this isn’t listed in the documentation!

Well, I created a couple ‘helper functions’ that provide this information by simply iterating over the collections and displaying it to me via the VBE Immediate Windows.

Continue reading

Removing Image Exif Properties Using WIA in VBA

So I was wrong in my last article, I wasn’t quite done with WIA yet, I had forgotten about deleting properties!

If you missed my previous post regarding WIA and working with image Exif metadata, here are a few links to get you up to speed:

Today, I will provide 2 procedures:

  • Delete a single Exif metadata property
  • Delete all the Exif metadata properties

This one took me a little longer to figure out as I could not find any examples or documentation that actually explained how to make it work. So this was a lot of trial and error. Especially for the WIA_RemoveAllExifPropeties, figuring out that you couldn’t delete the DocumentName property or the whole thing didn’t work.

Enough blah, blah, here’s the code.

Continue reading

Setting an Image Exif Property Using WIA in VBA

So I wanted to wrap up my exploration of WIA and image Exif metadata by showing you how you can use WIA to not only read values, but also set them!

If you missed my previous post regarding WIA and Exif metadata, here are a few links:

 
Continue reading

Getting a Specific Image Property Using WIA in VBA

In a continuation of exploring working with image Exif metadata via VBA, specifically working this time with WIA, I thought I’d demonstrate how you can retrieve a single property value.

Reading A Specific Exif Property with WIA

Obviously, there are a couple of ways we could do this:

  • Get the complete list of properties and their values and pull out the one we’re after
  • Check if the property exists, and if it does pull just that one

Today, I’ve chosen to concentrate on the latter as it is more efficient IMHO.

Continue reading

Getting Image Properties (Exif Metadata) Using WIA in VBA

I recently done a series of posts relating to working with image properties (Exif metadata):

and so on.

Well, there’s another means to get this information very easily and that to use the Windows Image Acquisition (WIA) library and read off the properties.

Continue reading