Fixed a pixel mode issue during image upload

This commit is contained in:
Phin 2024-09-23 18:18:51 +05:30
parent cc03fbbf8b
commit dab6e09a8a

View file

@ -9,7 +9,7 @@ import requests
def uploadToImgur(url: str) -> Optional[str]: def uploadToImgur(url: str) -> Optional[str]:
try: try:
originalImageBytesIO = io.BytesIO(requests.get(url).content) originalImageBytesIO = io.BytesIO(requests.get(url).content)
originalImage = Image.open(originalImageBytesIO) originalImage = Image.open(originalImageBytesIO).convert("RGB")
newImage = Image.new("RGB", originalImage.size) newImage = Image.new("RGB", originalImage.size)
newImage.putdata(originalImage.getdata()) # pyright: ignore[reportArgumentType] newImage.putdata(originalImage.getdata()) # pyright: ignore[reportArgumentType]
maxSize = config["display"]["posters"]["maxSize"] maxSize = config["display"]["posters"]["maxSize"]