INNER CODE UNIT · Python

scale_size

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

    def scale_size(self, size):
        """根据DPI缩放尺寸"""
        return int(size * self.dpi_scale)
    
    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}")
                # 创建一个空白图像替代

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…