Skip to content

Instantly share code, notes, and snippets.

View RobinXL's full-sized avatar

Robin RobinXL

  • Silicon Valley
View GitHub Profile
@RobinXL
RobinXL / convert_dpi.py
Last active April 12, 2025 05:22
Convert image with correct DPI for tesseract OCR purpose
from subprocess import Popen,PIPE, check_output
import os, sys
import tempfile
import uuid
import cv2
import pytesseract as pt
from PIL import Image
def convert_dpi(input_image):
path = tempfile.gettempdir()