Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, February 16, 2011 6:18:38 AM(UTC)

Groups: Registered
Posts: 1


I've seen examples to load vector images using the 32bit version. We currently have an issue loading them using the 64 bit version.

I have a .dwg file and the code we have looks like this:


LeadToolsApi.LOADFILEOPTION oLoadOption = new LeadToolsApi.LOADFILEOPTION();
LeadToolsApi.BITMAPHANDLE pBitMap = new LeadToolsApi.BITMAPHANDLE();
RasterImage oTempRaster = null;
LeadToolsApi.FILEINFO oFileInfo = new LeadToolsApi.FILEINFO();


int iReturn = LeadToolsApi.L_LoadBitmap(sOriginalFilePath, ref pBitMap, LeadToolsApi.BITMAPHANDLE.SizeOf, 0, LeadToolsApi.ORDER.ORDER_BGRORGRAY, ref oLoadOption, ref oFileInfo);

if (pBitMap.Flags == (LeadToolsApi.BITMAPHANDLE.BITMAPHANDLEFLAGS.Allocated | LeadToolsApi.BITMAPHANDLE.BITMAPHANDLEFLAGS.ConventionalMemory))
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(pBitMap));
Marshal.StructureToPtr(pBitMap, ptr, false);
oTempRaster = RasterImageConverter.FromLeadBitmap(ptr);


LeadToolsApi.L_FreeBitmap(ref pBitMap);

return oTempRaster;

We get the following exception:

2/7/2011 12:27:28 PM System.BadImageFormatException: Could not load file or assembly 'Leadtools.Codecs.Djv, Version=, Culture=neutral, PublicKeyToken=xxxx' or one of its dependencies. An attempt was made to load a program with an incorrect format.
File name: 'Leadtools.Codecs.Djv, Version=, Culture=neutral, PublicKeyToken=xxxxx'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Leadtools.Internal.L_DllLoader`1.Load(Char* , Char* , Char* )
at Leadtools.Internal.L_DllLoader`1.LoadWithPath(Char* , Char* , Char* )
at ?A0x26aadf20.LoadFileFilter(_FILEFILTER* pFilter)
at ?A0x26aadf20.ManagedUseFilter(_FILEFILTER* pFilter)
at UseFilter(_FILEFILTER* )
at ManagedFLTINFO(Int32 fmt, _INFODISPATCH* dis)
at L_FileInfo(Char* , _FILEINFO* , UInt32 , UInt32 , _LOADFILEOPTION* )
at Leadtools.Codecs.RasterCodecs.DoGetInformation(String fileName, Stream stream, Boolean totalPages, Int32 pageNumber)
at Leadtools.Codecs.RasterCodecs.GetInformation(String fileName, Boolean totalPages)
at JIC.Business.ImageProcessing.GetSourceFilePages(JIC_Control oJICControl, Boolean& bUsePixels, Int32 pageIndex)
at JIC.Business.ImageProcessing.ProcessControl(JIC_Control oJICControl, Int32 pageIndex)
at JIC.Business.ImageProcessing.ProcessControl(JIC_Control oJICControl)

What are we doing wrong? And is there an example for 64 bit that someone can send us.

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Thursday, February 17, 2011 6:58:04 AM(UTC)

Adam Boulad  

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

You are already discussing this issue in ticket  # 2011020810000148. Please continue discussing this issue by replying to that ticket. Also, please don't open more than one support case whether in forums or email regarding the same issue.
#3 Posted : Friday, October 14, 2016 11:13:07 AM(UTC)

Groups: Administrators
Posts: 27

Was thanked: 1 time(s) in 1 post(s)

In case someone is searching for BadImageFormatException and comes across this post, I recently posted an article on our blog about the BadImageFormatException that explains what to look for when trying to solve this problem.

Gabriel Smith
LEAD Technologies, Inc.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.076 seconds.