troubleshooting Question

FreeImage & VB.net error:Unable to find an entry point named FreeImage_OpenMultiBitmap in DLL FreeImage.dll.

Avatar of sadian
sadian asked on
Visual Basic.NET
4 Comments1 Solution1896 ViewsLast Modified:
I am attempting to utilize the FreeImage graphics library in my VB.net application to open and access a multipage .tiff file. I am able to load and access the first page of the .tiff file utilizing the FreeImage_Load function. However - when I attempt to use the FreeImage_OpenMultiBitmap function so that I can access more than one page of the multipage .tiff I continue to receive the following error:

An unhandled exception of type 'System.EntryPointNotFoundException' occurred in FreeImage example.exe
Additional information: Unable to find an entry point named FreeImage_OpenMultiBitmap in DLL FreeImage.dll.

The code I have used to define & access the win32 dll is as follows for the two functions I have used as examples:

to define FreeImage_OpenMultiBitmap:
    <DllImport("FreeImage.dll")> _
    Private Shared Function FreeImage_OpenMultiBitmap(ByVal format As FIF, ByVal filename As String, ByVal create_new As Boolean, ByVal read_only As Boolean, ByVal keep_in_cache_memory As Boolean, ByVal flags As Integer) As FIBITMAP
    End Function
to access:
        Dim dibLoad As Int32
        dibLoad = FreeImage_OpenMultiBitmap(freeImage.FIF.FIF_TIFF, "C:\test\04721.tif", 0, 0, 1, 0)

the function example that I have been able to get to work is defined as follows:
    <DllImport("FreeImage.dll")> _
    Private Shared Function FreeImage_Load(ByVal format As FIF, ByVal filename As String, ByVal flags As Integer) As FIBITMAP
    End Function
and accessed by:
    Dim pIntFIHandle As Int32 = FreeImage_Load(freeImage.FIF.FIF_TIFF, "C:\test\04721.tif", 0)

The documentation for freeimage that is in VB.net is sparse to say the least. I have located a VB.net wrapper that gave me the format for the Freeimage_Load function from: http://members.lycos.co.uk/nickpatemanpwp/soft-fivb.htm and the freeimage DLL can be found here: http://freeimage.sourceforge.net/index.html

an excerpt from the FreeImage manual referencing the OpenMultiBitmap function (in C++ unfortunately):

"FreeImage_OpenMultiBitmap

DLL_API FIMULTIBITMAP * DLL_CALLCONV FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL create_new, BOOL read_only, BOOL keep_cache_in_memory FI_DEFAULT(FALSE), int flags FI_DEFAULT(0));

Opens a multi-paged bitmap.

The first parameter tells FreeImage the bitmap-type of bitmap to be opened. Currently FIF_TIFF and FIF_ICO are supported. The second parameter specifies the name of the bitmap. When the third parameter is TRUE, it means that a new bitmap will be created rather than an existing one being opened. When the fourth parameter is TRUE the bitmap is opened read-only. The keep_cache_in_memory parameter is one purely for performance. When it is TRUE, all gathered bitmap data in the page manipulation process is kept in memory, otherwise it is lazily flushed to a temporary file on the hard disk in 64 Kb blocks. Note that depending on the amount of manipulation being performed and the size of the bitmap, the temporary data can become quite large. It’s advised to lazily flush to disc. The last parameter is used to change the behaviour or enable a feature in the bitmap plugin. Each plugin has its own set of parameters."

Finally - I have gone into the FreeImage source code and found where it specifically defines the entry point that the error is supposidy regarding. here is an except from FreeImage.cs:

    [DllImport(dllName, EntryPoint="FreeImage_OpenMultiBitmap")]
    public static extern FIMULTIBITMAP OpenMultiBitmap(FIF format, string filename, bool createNew, bool readOnly, bool keepCacheInMemory);



I appreciate any insight you can lend to help resolve this problem,

Regards,

Sadian

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros