Problem using deskew with output to blob

ImageMagickObject is a Windows COM+ interface to ImageMagick. COM+, Visual Basic, and Delphi users should post to this discussion group.
Post Reply
markt
Posts: 8
Joined: 2016-02-15T17:08:32-07:00
Authentication code: 1151

Problem using deskew with output to blob

Post by markt »

I'm taking a greyscale TIFF image from a scanner and then using ImageMagickObject to tidy the image prior to running Tesseract. Problem is that I get "Fatal User Error 1002:", "Deadlock due to omp_set_lock being called on lock already owned by thread". When I click OK to dismiss the error it crashes and closes Excel.

The image is a greyscale TIFF at 8.5" x 11", at 300DPI. Convert with deskew to a file takes about 10-12 seconds.

Problem only seems to show on the large image deskew to a blob output, using "logo:" "-deskew" "40%" with output to the blob is OK.

Can anyone offer any suggestions?

The line that throws the error is:-

Code: Select all

IMimage1 = Array("TIFF:")  '   Specify the image type
sArg = objIM.Convert(sInterFName, "-crop", sArea, "+repage", "-shave", sBorder, _
	"-bordercolor", "white", "-border", sBorder, _
	"-white-threshold", FormatPercent(dWhiteThreshold, 0), "-deskew", "40%", IMimage1)
The following all work OK:-

Code: Select all

Call objIM.Convert(sInterFName, "-crop", sArea, "+repage", "-shave", sBorder, _
	"-bordercolor", "white", "-border", sBorder, _
	"-white-threshold", FormatPercent(dWhiteThreshold, 0), "-deskew", "40%", sPartFName)
    
Call objIM.Convert(sInterFName, "-crop", sArea, "+repage", "-shave", sBorder, _
	"-bordercolor", "white", "-border", sBorder, _
	"-white-threshold", FormatPercent(dWhiteThreshold, 0), sPartFName)
    
IMimage1 = Array("TIFF:")  '   Specify the image type
Call objIM.Convert(sInterFName, "-crop", sArea, "+repage", "-shave", sBorder, _
	"-bordercolor", "white", "-border", sBorder, _
	"-white-threshold", FormatPercent(dWhiteThreshold, 0), IMimage1)
    
IMimage2 = Array("TIFF:")  '   Specify the image type
sArg = objIM.Convert(sPartFName, IMimage2)
    
sArg = objIM.Convert(sPartFName, "-deskew", "40%", sPartFName)

IMimage2 = Array("TIFF:")  '   Specify the image type
sArg = objIM.Convert("logo:", "-deskew", "40%", IMimage2)
But the following which only performs the deskew with output to a blob throws the same error:-

Code: Select all

IMimage2 = Array("TIFF:")  '   Specify the image type
sArg = objIM.Convert(sPartFName, "-deskew", "40%", IMimage2)
markt
Posts: 8
Joined: 2016-02-15T17:08:32-07:00
Authentication code: 1151

Re: Problem using deskew with output to blob

Post by markt »

Suspect this deadlock error is a bug but I found I can workaround this by adding "+repage" prior to the output to the blob.

example:-

Code: Select all

IMimage2 = Array("TIFF:")  '   Specify the image type
sArg = objIM.Convert(sPartFName, "-deskew", "40%", "+repage", IMimage2)
Post Reply