Last active
October 21, 2025 09:23
-
-
Save iqiancheng/970ec0aed97a7491ea71c07e4e54c3c0 to your computer and use it in GitHub Desktop.
Revisions
-
iqiancheng revised this gist
Oct 21, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ find . -maxdepth 1 -type f -iname '*.png' -print0 | xargs -0 -I{} sh -c 'magick "$1" -background white -alpha remove -alpha off -strip -quality 85 "${1%.png}_q85.jpg"' _ {} ``` 说明 • 使用 -background white -alpha remove -alpha off 处理透明背景,避免黑底;如需其他颜色,把 white 改成你想要的颜色值(如 “#1e1e1e”)。 • -strip 会移除元数据以进一步减小体积;若需保留 ICC/EXIF,删除 -strip。 • 质量 75 是偏中高的网页常用档位;需要更高或更小体积,调节 -quality。 -
iqiancheng revised this gist
Oct 21, 2025 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,6 @@ find . -maxdepth 1 -type f -iname '*.png' -print0 | xargs -0 -I{} sh -c 'magick ``` 说明 • 使用 -background white -alpha remove -alpha off 处理透明背景,避免黑底;如需其他颜色,把 white 改成你想要的颜色值(如 “#1e1e1e”)。 • -strip 会移除元数据以进一步减小体积;若需保留 ICC/EXIF,删除 -strip。 • 质量 75 是偏中高的网页常用档位;需要更高或更小体积,调节 -quality。 -
iqiancheng revised this gist
Oct 21, 2025 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,4 +2,9 @@ ```bash # 把当前目录下所有 PNG 转成 75% 质量的 JPG,并在原文件名后加 _quality75.jpg find . -maxdepth 1 -type f -iname '*.png' -print0 | xargs -0 -I{} sh -c 'magick "$1" -background white -alpha remove -alpha off -strip -quality 85 "${1%.png}_q85.jpg"' _ {} ``` 说明 • 使用 -background white -alpha remove -alpha off 处理透明背景,避免黑底;如需其他颜色,把 white 改成你想要的颜色值(如 “#1e1e1e”)。 • -strip 会移除元数据以进一步减小体积;若需保留 ICC/EXIF,删除 -strip。 • 质量 75 是偏中高的网页常用档位;需要更高或更小体积,调节 -quality。 -
iqiancheng renamed this gist
Oct 21, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
iqiancheng created this gist
Oct 21, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ ```bash # 把当前目录下所有 PNG 转成 75% 质量的 JPG,并在原文件名后加 _quality75.jpg find . -maxdepth 1 -type f -iname '*.png' -print0 | xargs -0 -I{} sh -c 'magick "$1" -background white -alpha remove -alpha off -strip -quality 85 "${1%.png}_q85.jpg"' _ {} ```