Skip to content

Commit

Permalink
[FIX] Resource 경로 임시 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
C4NU committed Sep 5, 2023
1 parent 8dd12cf commit ef6d837
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
Binary file added Barlow-Light.ttf
Binary file not shown.
4 changes: 2 additions & 2 deletions Exif_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def __init__(self):
# 폰트 사이즈 (초기)
self.fontSize = 50
# 폰트 (초기)
self.font = ImageFont.truetype("./Resources/Fonts/Barlow/Barlow-Light.ttf", self.fontSize)
self.font = ImageFont.truetype("Barlow-Light.ttf", self.fontSize)

def GetExifData(self, image):
exifData = image._getexif()
Expand Down Expand Up @@ -77,7 +77,7 @@ def SetImageText(self, image, modelData, exifData, length):
y = image.height - (length / 2)

self.fontSize = length / 4.5
self.font = ImageFont.truetype("./Resources/Fonts/Barlow/Barlow-Light.ttf", self.fontSize)
self.font = ImageFont.truetype("Barlow-Light.ttf", self.fontSize)

draw.text(xy = (x,y - self.fontSize / 2), text = modelData,font=self.font, fill=(0,0,0), anchor="ms")
draw.text(xy = (x,y + self.fontSize), text = exifData,font=self.font, fill=(0,0,0), anchor="ms")
Expand Down
8 changes: 4 additions & 4 deletions Watermark_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ def __init__(self):
# 폰트 사이즈 (초기
self.fontSize = 30
# 폰트 (초기)
self.font = ImageFont.truetype("./Resources/Fonts/Poppins/Poppins-Light.ttf", self.fontSize)
self.font = ImageFont.truetype("Barlow-Light.ttf", self.fontSize)

def InsertWatermark(self, image, fontColor, watermarkText):
width, height = image.size

draw = ImageDraw.Draw(image)
x, y = int(width/2), int(height/2)

self.font = ImageFont.truetype("./Resources/Fonts/Poppins/Poppins-Light.ttf", self.fontSize)
self.font = ImageFont.truetype("Barlow-Light.ttf", self.fontSize)

if fontColor: # FontColor가
draw.text(xy=(width / 2 - (self.fontSize * 2), height / 2), text = watermarkText,font=font, fill=(0,0,0))
draw.text(xy=(width / 2 - (self.fontSize * 2), height / 2), text = watermarkText,font=self.font, fill=(0,0,0))
else:
draw.text(xy=(width / 2 + (self.fontSize * 2), height / 2), text = watermarkText, font = font, fill = (255,255,255))
draw.text(xy=(width / 2 + (self.fontSize * 2), height / 2), text = watermarkText, font = self.font, fill = (255,255,255))

return image

Expand Down
6 changes: 3 additions & 3 deletions WebP_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
from PIL import Image, ImageDraw, ImageFont

import os
import Watermark_module
#import Watermark_module
import Exif_module

class Converter():
def __init__(self) -> None:
self.watermark = Watermark_module.Watermark()
#self.watermark = Watermark_module.Watermark()
self.exif = Exif_module.Exif()

def ConvertImage(self, filePath, savePath, saveName, loselessOpt, imageQualityOpt, exifOpt, iccProfileOpt, exactOpt, watermarkText, exifViewOpt):
Expand All @@ -35,7 +35,7 @@ def ConvertImage(self, filePath, savePath, saveName, loselessOpt, imageQualityOp
iccProfile = imageData.info['icc_profile']

#image = self.watermark.InsertWatermark(image=image, fontColor=watermarkColor, watermarkText=watermarkText)
print(exifOpt)

if exifOpt == True:
if iccProfileOpt == True:
image.save(dest, format="webp", loseless=loselessOpt, quality=imageQualityOpt, exif=exifData, exact = exactOpt, icc_profile=iccProfile)
Expand Down
6 changes: 6 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ def ExifPaddingOption(self, state):
self.exifPaddingOpt = False

def main():
try:
os.chdir(sys._MEIPASS)
print(sys._MEIPASS)
except:
os.chdir(os.getcwd())

app = QApplication(sys.argv)
myWindow = WindowClass()
myWindow.show()
Expand Down

0 comments on commit ef6d837

Please sign in to comment.