VBA - Image Dimensions (Width and Hieght) in Pixels, without loading into a control
Posted on 2005-05-04
I have an Image Batching application that I am writting in Access2000 (will upgrade to 2003 soon) on XP Sp1. It handles sometimes over 800 images at a time that vary from 5mb to 114mb+ in size.
For each selected file (that is stored on a CD/Removable Media/Any Drive), I need a VBA function to retrieve, and store in an existing table, the following info:
* Filename with extension - not the full path.
* Image Width in Pixels
* Image Height in Pixels
As the files are so huge, and many, I don't want to load them into a control on a form, but reference them directly from their current path. And I need to do it very quickly.
The stdOle and Access image objects cannot handle .tif files, otherwise I would be out of the woods. (ie: IPictureDisp )
I was looking at GDI+ API calls to retreive the info, but this is beyond my programming scope. I don't want to rely on purchasing ActiveX controls to handle it.
This API Function: GetBitmapDimensionEx doesn't work, because 'the retrieved dimensions must have been set by the SetBitmapDimensionEx function' (MSDN).
Windows Explorer accesses the dimensions of the bitmaps (Tiff's and Jpeg's) perfectly and super quick, and is displayed by choosing View>Details, then View>Choose Details and 'Checking' the Dimensions box. That information is all I need, but I need it in an MS Access table.
Simple Question, difficult answer.