gpt4 book ai didi

python - 无法将 RGBA 模式写为 BMP pytesser

转载 作者:行者123 更新时间:2023-12-05 01:06:34 25 4
gpt4 key购买 nike

我在用 PyTesser从图像中获取文本。它主要工作正常,但在某些情况下我收到此错误:

cannot write mode RGBA as BMP

图像没有问题,很好,相同的只是文本不同。

最佳答案

我有同样的问题——问题是透明度。 (将 rbgy 转换为 rbg)添加白色背景修复了它。

im = Image.open(C:\image.png)
bg = Image.new("RGB", im.size, (255,255,255))
bg.paste(im,im)
print image_to_string(bg)

关于python - 无法将 RGBA 模式写为 BMP pytesser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20020206/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com