INNER CODE UNIT · Python

load_scaled_image

RQLuo/MixTeX-Latex-OCR · mixtexgui/mixtex_ui.py:117

    def load_scaled_image(self, image_path, custom_scale=None):
        """按DPI比例加载图像"""
        # 使用自定义缩放因子或系统DPI缩放
        scale = custom_scale if custom_scale is not None else getattr(self, 'dpi_scale', 1.0)
        
        # 确保路径存在
        if not os.path.exists(image_path):
            # 尝试查找替代路径
            alt_path = os.path.join(os.path.dirname(sys.executable), os.path.basename(image_path))
            if os.path.exists(alt_path):
                image_path = alt_path
            else:
                print(f"找不到图像文件: {image_path}")
                # 创建一个空白图像替代
                return Image.new('RGB', (64, 64), (200, 200, 200))
        
        # 加载原始图像
        original = Image.open(image_path)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…