Begin refactor
This commit is contained in:
25
src/ImageContainer.py
Normal file
25
src/ImageContainer.py
Normal file
@@ -0,0 +1,25 @@
|
||||
import cv2
|
||||
from PIL import Image, ImageTk
|
||||
|
||||
class ImageContainer:
|
||||
_imageData = None
|
||||
_path = None
|
||||
|
||||
def loadImage(self, path: str) -> None:
|
||||
""" Load image file from the path.
|
||||
|
||||
:param path: Path to the image file.
|
||||
"""
|
||||
imgcv2 = cv2.imread(path)
|
||||
height, width, channels = imgcv2.shape
|
||||
|
||||
# Open and resize image (optional)
|
||||
_imageData = Image.open(path)
|
||||
_imageData = _imageData.resize((height, width), Image.LANCZOS) # Resize to fit frame
|
||||
|
||||
_path = path
|
||||
|
||||
print("Opened image:", path)
|
||||
|
||||
def getDimensions(self) -> tuple[int,int]:
|
||||
return self._imageData.shape
|
||||
Reference in New Issue
Block a user