Merge 3d8342cb4e0453706111099a58b1834c1130b676 into 5a278381e38c4583d6285d07bb922e5068a987d0

This commit is contained in:
shamoon 2025-04-23 07:11:27 +00:00 committed by GitHub
commit 74ea03620f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 0 deletions

View File

@ -108,6 +108,7 @@ class RasterisedDocumentParser(DocumentParser):
"image/bmp",
"image/gif",
"image/webp",
"image/heic",
]
def has_alpha(self, image) -> bool:

View File

@ -16,5 +16,6 @@ def tesseract_consumer_declaration(sender, **kwargs):
"image/gif": ".gif",
"image/bmp": ".bmp",
"image/webp": ".webp",
"image/heic": ".heic",
},
}

Binary file not shown.

View File

@ -880,6 +880,12 @@ class TestParserFileTypes(DirectoriesMixin, FileSystemAssertsMixin, TestCase):
self.assertIsFile(parser.archive_path)
self.assertIn("this is a test document", parser.get_text().lower())
def test_heic(self):
parser = RasterisedDocumentParser(None)
parser.parse(os.path.join(self.SAMPLE_FILES, "simple.heic"), "image/heic")
self.assertIsFile(parser.archive_path)
self.assertIn("pizza", parser.get_text().lower())
@override_settings(OCR_IMAGE_DPI=200)
def test_gif(self):
parser = RasterisedDocumentParser(None)