Skip to content

Commit

Permalink
fix: pyheif isuue for windows using pillow-heif
Browse files Browse the repository at this point in the history
  • Loading branch information
Kohulan committed Mar 30, 2023
1 parent 624226e commit 49bae11
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions DECIMER/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-

"""
DECIMER V2.2.1 Python Package.
DECIMER V2.2.2 Python Package.
============================
This repository contains DECIMER-V2,Deep lEarning for Chemical ImagE Recognition) project
Expand All @@ -23,7 +23,7 @@
"""

__version__ = "2.2.1"
__version__ = "2.2.2"

__all__ = [
"DECIMER",
Expand Down
16 changes: 5 additions & 11 deletions DECIMER/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import DECIMER.Efficient_Net_encoder
import DECIMER.Transformer_decoder
from PIL import Image, ImageEnhance
from pillow_heif import register_heif_opener
import numpy as np
import io
import cv2
import pystow
import pathlib
import pyheif
import zipfile

TARGET_DTYPE = tf.float32
Expand Down Expand Up @@ -93,16 +93,10 @@ def HEIF_to_pillow(image_path: str):
___
Output: PIL.Image
"""
heif_file = pyheif.read(image_path)
pil_im = Image.frombytes(
heif_file.mode,
heif_file.size,
heif_file.data,
"raw",
heif_file.mode,
heif_file.stride,
)
return pil_im.convert("RGBA")
register_heif_opener()

heif_file = Image.open(image_path).convert("RGBA")
return heif_file


def remove_transparent(image_path: str):
Expand Down
2 changes: 1 addition & 1 deletion Python_Requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ tensorflow>=2.8.0
opencv-python
pystow
efficientnet
pyheif
pillow-heif
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="decimer",
version="2.2.1",
version="2.2.2",
author="Kohulan Rajan",
author_email="kohulan.rajan@uni-jena.de",
maintainer="Kohulan Rajan",
Expand All @@ -22,7 +22,7 @@
"tensorflow==2.10.1",
"opencv-python",
"pystow",
"pyheif",
"pillow-heif",
"efficientnet",
],
package_data={"DECIMER": ["repack/*.*", "efficientnetv2/*.*", "Utils/*.*"]},
Expand Down

0 comments on commit 49bae11

Please sign in to comment.