LEADTOOLS Support
Imaging
Imaging SDK Questions
Not enough memory available at rasterimageconverter.makecompatible
#1
Posted
:
Tuesday, April 4, 2017 9:36:20 PM(UTC)
Groups: Registered
Posts: 50
Hi team,
"Not enough memory available at leadtools.drawing.rasterimageconverter.makecompatible.."
My customers are getting this error a lot. Any suggestion? Thanks!
#2
Posted
:
Wednesday, April 5, 2017 3:57:38 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
Typically, memory issues can arise when running 32-bit applications, as 32-bit applications all share the same addressable memory space. Note that when files are loaded into a LEADTOOLS RasterImage, depending on the compression and complexicity of the image the size in memory may be significantly larger than its size on disk. Memory issues can be alleviated by closing unnecessary 32-bit applications so the others will have more memory to work with, by reducing the number of concurrent images processed, and by ensuring the garbage collector has sufficient time to reclaim memory from objects that go out of scope. This can be done explicitly by calling RasterImage.Dispose() once the image is no longer needed.
https://www.leadtools.com/help/l...sterimage-dispose().htmlAlternatively, using a 64-bit architecture will allow your application more addressable memory space than a 32-bit architecture by several orders of magnitude. This will require recompiling your application to use the 64-bit LEADTOOLS libraries and to target the x64 platform.
Edited by moderator Wednesday, November 1, 2017 8:55:45 AM(UTC)
| Reason: Not specified
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
#3
Posted
:
Friday, April 7, 2017 5:51:14 PM(UTC)
Groups: Registered
Posts: 50
Nick, that is not the answer I was looking for. Actually, I think there is something wrong with this method makecompatible. My code just open a document, then makecompatible, then close, If I keep doing this sequence for at most 3 times, I will get this error. If I comment the function call out, issue won't happen.
#4
Posted
:
Monday, April 10, 2017 9:48:07 PM(UTC)
Groups: Registered
Posts: 50
Nick, can you advise? is there any other workaround?
#5
Posted
:
Tuesday, April 11, 2017 8:36:07 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
I apologize for the delayed response. Would you mind posting the code you're using which causes this issue to occur?
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
#6
Posted
:
Tuesday, April 11, 2017 4:43:29 PM(UTC)
Groups: Registered
Posts: 50
I appreciate the help. Here is my code. Basically, I have a package that has multiple filings with each filing has multiple multi-page tiff document. I have stamps for each page stored in objects then load then burn..
Private Sub BurnPackage(sender As Object, e As DoWorkEventArgs)
Dim _codecs As RasterCodecs = Nothing
Dim _annCodecs As AnnCodecs = Nothing
Dim _annotationsContainer As AnnContainer = Nothing
Dim _rasImage As RasterImage = Nothing
Try
_codecs = New RasterCodecs
_annCodecs = New AnnCodecs
_annotationsContainer = New AnnContainer
Dim p As Package = CType(e.Argument, Package)
Dim g As Graphics = Graphics.FromHwnd(Process.GetCurrentProcess().MainWindowHandle)
Dim xres, yres As Integer
For Each f As Filing In p.Filings
For Each d As DocumentImage In f.Images.Where(Function(img) img.Recordable = True)
_codecs.Options.Load.AllPages = True
Using ms As New MemoryStream(d.Data)
_rasImage = _codecs.Load(ms)
End Using
_annotationsContainer.Bounds = New AnnRectangle(0, 0, _rasImage.Width, _rasImage.Height)
xres = _rasImage.XResolution
yres = _rasImage.YResolution
For i As Integer = 1 To _rasImage.PageCount
_annotationsContainer.Objects.Clear()
If d.StampData(i).Length > 0 Then
_rasImage.Page = i
d.StampData(i).Position = 0
_annCodecs.Load(d.StampData(i), _annotationsContainer, 1)
_rasImage.XResolution = g.DpiX
_rasImage.YResolution = g.DpiY
End If
MakeImageGDIPlusCompatible(_rasImage)
Using g2 As System.Drawing.Graphics = Leadtools.Drawing.RasterImagePainter.CreateGraphics(_rasImage).Graphics
_annotationsContainer.Draw(g2)
End Using
d.StampData(i).SetLength(0)
_rasImage.XResolution = xres
_rasImage.YResolution = yres
p.ProcessedPages += 1
Next
Using ms2 As New MemoryStream
_codecs.Save(_rasImage, ms2, RasterImageFormat.CcittGroup4, 1, 1, -1, 1, CodecsSavePageMode.Overwrite)
d.Data = ms2.ToArray()
d.Stamped = True
End Using
Next
Next
Catch ex As Exception
MyMsgBox.ShowError(ex)
Finally
If _codecs IsNot Nothing Then _codecs.Dispose()
If _annotationsContainer IsNot Nothing Then _annotationsContainer.Dispose()
If _rasImage IsNot Nothing Then _rasImage.Dispose()
End Try
End Sub
Public Sub MakeImageGDIPlusCompatible(image As RasterImage)
Dim reason As ImageIncompatibleReason = RasterImageConverter.TestCompatible(image, True)
If reason <> ImageIncompatibleReason.Compatible Then
RasterImageConverter.MakeCompatible(image, PixelFormat.DontCare, True)
End If
End Sub
#7
Posted
:
Thursday, April 13, 2017 10:37:52 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
Hello,
There does not appear to be anything out-of-the-ordinary with the code you've pasted which could cause the issue. However, I'm unable to reproduce the issue locally. Would it be possible for you to provide us with a small sample application which replicates the issue so we could test locally? I will send you an email to the address we have on file registered with your forum account. If this is the incorrect address, please let me know. You can respond to this email with the sample attached (no need to include the LEADTOOLS libraries, we have those) and once received we'll investigate the issue farther.
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
#8
Posted
:
Sunday, April 16, 2017 5:01:59 PM(UTC)
Groups: Registered
Posts: 50
Hi Nick, every time you guys saying emailed me, I couldn't find the email. This is frustrating... is there a number I can call?
#9
Posted
:
Monday, April 17, 2017 8:23:28 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
#10
Posted
:
Tuesday, April 18, 2017 2:56:57 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
Hello,
Please note we have multiple email addresses on file for your account with the one you're posting on listed as an alternate. It may be the case the message was delivered by our CRM system to your primary account. Alternatively, please check your spam and junk folders for any email from
support@leadtools.com, and ensure there is no filtering that would prevent messages from this address from being delivered.
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
#11
Posted
:
Tuesday, April 18, 2017 6:11:08 PM(UTC)
Groups: Registered
Posts: 50
Nick, is the primary address ending with @micropact.com? If not, that is invalid.
#12
Posted
:
Wednesday, April 19, 2017 7:30:08 PM(UTC)
Groups: Registered
Posts: 50
I changed to use automation manager instead of GDI+ to burn stamps, so I don't need use MakeCompatible. I solved my problem.
#13
Posted
:
Thursday, April 20, 2017 9:02:42 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 163
Was thanked: 9 time(s) in 9 post(s)
Hello,
I'm glad you were able to find a workaround for this issue. Please note the primary email address we have on file for you does not use the @micropact.com domain name. In order to better assist you going forward, please send an email to
support@leadtools.com so we can update your contact information accordingly. Thank you.
Nick Crook
Developer Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Imaging
Imaging SDK Questions
Not enough memory available at rasterimageconverter.makecompatible
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.