Memory access error with gflAddText function

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: XnTriq, helmut, xnview

tblack1100
Posts: 4
Joined: Thu Dec 08, 2005 2:22 pm

Memory access error with gflAddText function

Post by tblack1100 »

I've included the sample code I use to merge TIFF images into a multi-page TIFF file. Everything works great, except the recently added gflAddText function shown below. This function works fine in the sample but for some reason it generates memory access error.

Any assistance would be appreciated.


Thanks

*** BEGIN SAMPLE CODE ****
Public Function Merge(ByVal strDestFile As String)
On Error GoTo MergeErr
Dim intRV As Integer
Dim intInd As Integer
Dim lngHandle As Long
Dim prmFontColor As GFL_COLOR
Dim Txt As String
Dim FontName As String
Dim FontSize As Long
Dim FontBold As Boolean
Dim FontItalic As Boolean
Dim FontStrikeOut As Boolean
Dim FontUnderline As Boolean

prmFontColor.Blue = 255
prmFontColor.Green = 255
prmFontColor.Red = 255

'Create the TIFF file
intRV = gflFileCreate(lngHandle, strDestFile, lngCount, prmSaveParams)

'If no error get default loading parameters for each image
If intRV = GFL_NO_ERROR Then
For intInd = 0 To lngCount - 1
gflGetDefaultLoadParams prmLoadParams

' Load the image
intRV = gflLoadBitmap(arySrcFile(intInd), lngBitmapPtr, prmLoadParams, prmInfos)

' Overlay text descriptor
Txt = "gflAddText"
FontName = "Verdana"
FontSize = "24"
FontBold = True
FontItalic = False
FontStrikeOut = False
FontUnderline = False

'If no error, add file info to image
If intRV = GFL_NO_ERROR Then
extGetGflBitmapFromPtr lngBitmapPtr, objBitmap
intRV = gflAddText(objBitmap, Txt, FontName, 10, 10, FontSize, 0, CByte(FontItalic), CByte(FontBold), CByte(FontStrikeOut), CByte(FontUnderline), CByte(True), prmFontColor)
End If

'If no error, get data in Gfl_Bitmap and add image to TIFF file
If intRV = GFL_NO_ERROR Then
gflFileAddPicture lngHandle, objBitmap
End If
Next

'Close the TIFF file
gflFileClose lngHandle
End If

Exit Function
MergeErr:
MsgBox "Error merging: " & Err.Description
End Function


**** END SAMPLE CODE ****
User avatar
xnview
Author of XnView
Posts: 44920
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Memory access error with gflAddText function

Post by xnview »

tblack1100 wrote:I've included the sample code I use to merge TIFF images into a multi-page TIFF file. Everything works great, except the recently added gflAddText function shown below. This function works fine in the sample but for some reason it generates memory access error.

Any assistance would be appreciated.
Perhaps you could send me original picture files?
Pierre.
tblack1100
Posts: 4
Joined: Thu Dec 08, 2005 2:22 pm

Re: Memory access error with gflAddText function

Post by tblack1100 »

They are medical record images, so I can't send those to you. They are the same images I've used numerous times with your samples and this is the first time an error has occurred. They are scanned image TIFF files that are about 15k-45k in size. They merge just fine and are readable as multi-page TIFF files. File size of the merged, multi-page file is another issue. Why do I end up with a merged file size much larger than the the sum total of the individual files?

Once I've determined if this libraray will serve my purpose, I was planning on purchasing a copy. Do I need to purchase a copy now to get the features/capabilities I need?


Thanks
User avatar
xnview
Author of XnView
Posts: 44920
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Memory access error with gflAddText function

Post by xnview »

tblack1100 wrote:They are medical record images, so I can't send those to you. They are the same images I've used numerous times with your samples and this is the first time an error has occurred. They are scanned image TIFF files that are about 15k-45k in size. They merge just fine and are readable as multi-page TIFF files. File size of the merged, multi-page file is another issue. Why do I end up with a merged file size much larger than the the sum total of the individual files?
You must change the Compression parameter
Once I've determined if this libraray will serve my purpose, I was planning on purchasing a copy. Do I need to purchase a copy now to get the features/capabilities I need?
No
Pierre.
tblack1100
Posts: 4
Joined: Thu Dec 08, 2005 2:22 pm

Re: Memory access error with gflAddText function

Post by tblack1100 »

Could you give me a code example for chaning the compression? Thanks
User avatar
xnview
Author of XnView
Posts: 44920
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Memory access error with gflAddText function

Post by xnview »

tblack1100 wrote:Could you give me a code example for chaning the compression? Thanks
prmSaveParams.Compression = GFL_ZIP (for example)
Pierre.