First, I change 1234564.tif.jpg the image filename extension to 1234564.tif , 1234564.jpg , 1234564.bmp.
Second, I try to use Stemmer.Cvb.Image.FromFile() function and Cvb.Image.LoadImageFile() function to load the three images, but it has a error message.
I’m not totally sure what you are trying to do. But determins the file type by its extension. If the data inside the file doesn’t resemble that format, loading is not possible.
can it bee that your sample program is targetting 64bit Windows but the Visual Studio configuration setting is AnyCPU and the Prefer32Bit option is checked? In that case you will get all the problems mentioned in several articles here regarding a mix of 32bit and 64bit runtimes such as here or here.
This code here works fine having a x64 configuration or having the Prefer32Bit option disabled:
In more detail: Bitmaps and TIFs (and all of its high-bit versions) are written by the CVCImg.DLL. Other formats such as PNG, TGA, JPEG, JPEG2000 etc. are implemented in the CVCFile.DLL which makes use of OpenSource libraries. The loading of the CVCFile.DLL fails in case of the 32/64 bit mismatch.
Because my user’s AOI machine save the image file extension to be *.tif,jpg, I use mouse to change the image’s extension to be *.tif, *.jpg, and *.bmp and use Stemmer.Cvb.Image.FromFile() function and Cvb.Image.LoadImageFile() function to load the images.
I disable Prefer32Bit and try the Martin’s C# code to load C:\cvb\tutorial\clara."bmp is normal.
I use the same code to load my .tif,jpg,.tif, *.jpg, and *.bmp images , has load files error.
I open the *.tif.jpg image and *.tif, *.jpg, and *.bmp images which be changed extension by paint , they can be opened.
Some software packages (like for example Windows Paint) determine the Bitmap file type by looking at the first few bytes of a file and if these match a known bitmap format the use the matching loader. just looks at the file’s extension. Therefore if you take - for example - a *.bmp file and rename it to - for example - *.jpg, will simply apply the jpg loader to it, but the content is not a jpeg file and therefore loading Fails.
In short: If the file name’s extension does not match the file type, won’t be able to load it.