File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
lib/idp_common_pkg/idp_common/ocr Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -98,9 +98,19 @@ def __init__(
9898
9999 # Extract DPI from image configuration
100100 image_config = ocr_config .get ("image" , {})
101- self .dpi = image_config .get (
102- "dpi" , 150
103- ) # Default to 150 DPI if not specified
101+ dpi_value = image_config .get ("dpi" , 150 )
102+
103+ # Convert DPI to integer if it's a string
104+ if isinstance (dpi_value , str ):
105+ try :
106+ self .dpi = int (dpi_value ) if dpi_value .strip () else 150
107+ except (ValueError , AttributeError ):
108+ logger .warning (
109+ f"Invalid DPI value '{ dpi_value } ', using default 150"
110+ )
111+ self .dpi = 150
112+ else :
113+ self .dpi = int (dpi_value ) if dpi_value is not None else 150
104114
105115 # Extract enhanced features
106116 features_config = ocr_config .get ("features" , [])
You can’t perform that action at this time.
0 commit comments