{"id":49,"date":"2025-09-10T14:28:20","date_gmt":"2025-09-10T06:28:20","guid":{"rendered":"http:\/\/38.147.176.197\/?p=49"},"modified":"2025-09-12T09:10:39","modified_gmt":"2025-09-12T01:10:39","slug":"iphone%e6%89%8b%e6%9c%ba%e7%9b%b8%e7%89%87heic%e8%bd%ac%e6%8d%a2jpg","status":"publish","type":"post","link":"https:\/\/blog.xiaolin2000.club\/?p=49","title":{"rendered":"iPhone\u624b\u673a\u76f8\u7247HEIC\u8f6c\u6362JPG"},"content":{"rendered":"\n<figure class=\"wp-block-video\"><video controls src=\"http:\/\/47.121.138.187:5678\/d\/%F0%9F%A5%9D115%E7%BD%91%E7%9B%98\/115\/%E6%95%99%E7%A8%8B\/%E5%9B%BE%E7%89%87%E6%A0%BC%E5%BC%8F%E8%BD%AC%E6%8D%A2.mp4?sign=ZEbyGgsX5xFF-YWsgs3N9OEUOMqH3dETg7kSKiXqObU=:0\"><\/video><\/figure>\n\n\n\n<p>\u4e0b\u8f7d\u5730\u5740\uff1a<\/p>\n\n\n\n<p><a href=\"https:\/\/www.alipan.com\/s\/Hj7yDUnGhEb\" target=\"_blank\" rel=\"noreferrer noopener\">\u963f\u91cc\u4e91\u76d8\u4e0b\u8f7d<\/a><\/p>\n\n\n\n<p>\u4e00\u3001\u4ee3\u7801\u4fdd\u5b58\u4e3aheic_to_jpg_gui.py<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import os\nimport tkinter as tk\nfrom tkinter import filedialog, messagebox\nfrom PIL import Image\nimport pillow_heif\n\ndef convert_heic_to_jpg(input_folder, output_folder=None):\n    if output_folder is None:\n        output_folder = os.path.join(input_folder, \"converted_jpg\")\n\n    os.makedirs(output_folder, exist_ok=True)\n\n    converted = 0\n    failed = 0\n\n    for file_name in os.listdir(input_folder):\n        if file_name.lower().endswith(\".heic\"):\n            heic_path = os.path.join(input_folder, file_name)\n            jpg_name = os.path.splitext(file_name)&#91;0] + \".jpg\"\n            jpg_path = os.path.join(output_folder, jpg_name)\n\n            try:\n                heif_file = pillow_heif.open_heif(heic_path)\n                image = Image.frombytes(\n                    heif_file.mode,\n                    heif_file.size,\n                    heif_file.data,\n                    \"raw\"\n                )\n                image.save(jpg_path, \"JPEG\", quality=95)\n                converted += 1\n            except Exception as e:\n                failed += 1\n                print(f\"\u274c \u8f6c\u6362\u5931\u8d25: {file_name}, \u9519\u8bef: {e}\")\n\n    return converted, failed, output_folder\n\ndef main():\n    root = tk.Tk()\n    root.withdraw()\n\n    input_dir = filedialog.askdirectory(title=\"\u9009\u62e9 HEIC \u7167\u7247\u6587\u4ef6\u5939\")\n    if not input_dir:\n        messagebox.showinfo(\"\u53d6\u6d88\", \"\u6ca1\u6709\u9009\u62e9\u6587\u4ef6\u5939\uff0c\u7a0b\u5e8f\u9000\u51fa\u3002\")\n        return\n\n    converted, failed, out_dir = convert_heic_to_jpg(input_dir)\n    messagebox.showinfo(\n        \"\u5b8c\u6210\",\n        f\"\u2705 \u8f6c\u6362\u5b8c\u6210\uff01\\n\\n\u6210\u529f: {converted} \u5f20\\n\u5931\u8d25: {failed} \u5f20\\n\u8f93\u51fa\u76ee\u5f55: {out_dir}\"\n    )\n\nif __name__ == \"__main__\":\n    main()<\/code><\/pre>\n\n\n\n<p>\u4e8c\u3001\u6253\u5305<\/p>\n\n\n\n<p>cmd\u4e2d\u6267\u884c\u4e0b\u9762\u547d\u4ee4\uff0c\u5b89\u88c5\u4f9d\u8d56<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip install pillow pillow-heif pyinstaller<\/code><\/pre>\n\n\n\n<p>\u6267\u884c\u4e0b\u9762\u547d\u4ee4\u6253\u5305\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pyinstaller --onefile --windowed heic_to_jpg_gui.py<\/code><\/pre>\n\n\n\n<p>\u6253\u5305\u5b8c\u6210\u540e\uff0cdist \u6587\u4ef6\u5939\u91cc\u4f1a\u751f\u6210\uff1a<\/p>\n\n\n\n<p>heic_to_jpg_gui.exe<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u8f7d\u5730\u5740\uff1a \u963f\u91cc\u4e91\u76d8\u4e0b\u8f7d \u4e00\u3001\u4ee3\u7801\u4fdd\u5b58\u4e3aheic_to_jpg_gui.py \u4e8c\u3001\u6253\u5305 cmd\u4e2d\u6267\u884c\u4e0b\u9762\u547d\u4ee4\uff0c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":56,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[30,31,28,29,27],"class_list":["post-49","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-shiyong","tag-heic","tag-jpg","tag-28","tag-29","tag-27"],"_links":{"self":[{"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":4,"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":90,"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions\/90"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=\/wp\/v2\/media\/56"}],"wp:attachment":[{"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.xiaolin2000.club\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}