Skip to content

Commit

Permalink
converter
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel4-Scratch committed Jul 29, 2024
1 parent 8406917 commit 2ec33df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion miao.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ import zlib
import sys
import os

image_file_extensions = [
".jpg", ".jpeg", ".png", ".gif", ".bmp", ".tiff", ".tif", ".webp", ".svg",
".ico", ".heif", ".heic", ".raw", ".cr2", ".nef", ".orf", ".sr2", ".arw",
".dng", ".rw2", ".pef", ".raf", ".3fr", ".ai", ".eps", ".psd"
]


def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
Expand Down Expand Up @@ -146,7 +153,11 @@ if len(sys.argv) > 1:
f.close()
else:
if os.path.isfile(sys.argv[1]):
ImageDisplayer(sys.argv[1]).root.mainloop()
filename, file_extension = os.path.splitext(sys.argv[1])
if file_extension == ".miao":
ImageDisplayer(sys.argv[1]).root.mainloop()
elif file_extension in image_file_extensions:
save_image_data(sys.argv[1], filename+".miao")
else:
ImageDisplayer(resource_path("help.miao")).root.mainloop()
else:
Expand Down
2 changes: 1 addition & 1 deletion version.rc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ VSVersionInfo(
[
StringStruct(u'FileDescription', u'Miao image viewer and converter'),
StringStruct(u'ProductName', u'Miao Viewer'),
StringStruct(u'ProductVersion', u'0.1.3'),
StringStruct(u'ProductVersion', u'0.1.4'),
]
)
]),
Expand Down

0 comments on commit 2ec33df

Please sign in to comment.