diff --git a/image_tool_build.bash b/image_tool_build.bash new file mode 100755 index 0000000..2a77667 --- /dev/null +++ b/image_tool_build.bash @@ -0,0 +1,2 @@ +rm -rf image_tool_builds +pyinstaller --onefile --distpath image_tool_builds -n imgtools_linux image_tools.py diff --git a/image_tools.py b/image_tools.py new file mode 100644 index 0000000..52da2b8 --- /dev/null +++ b/image_tools.py @@ -0,0 +1,24 @@ +from pepy.pe import PEFile +from pycns import save_icns +import sys + +if __name__ == '__main__': + if len(sys.argv) < 4 or len(sys.argv) > 5: + print ('image_tools \n' + ' commands: save_icns input_file output_file\n' + ' replace_icon input_exe icon_path [output_path]') + sys.exit() + + command = sys.argv[1] + file1, file2 = sys.argv[2:4] + + output_path = file1 + if len(sys.argv) == 5: + output_path = sys.argv[4] + + if command == 'save_icns': + save_icns(file1, file2) + elif command == 'replace_icon': + p = PEFile(file1) + p.replace_icon(file2) + p.write(output_path)