{"id":1608,"date":"2022-03-15T09:02:19","date_gmt":"2022-03-15T09:02:19","guid":{"rendered":"https:\/\/www.ipcpu.com\/?p=1608"},"modified":"2022-07-22T09:03:28","modified_gmt":"2022-07-22T09:03:28","slug":"imagemagick","status":"publish","type":"post","link":"https:\/\/c.ipcpu.com\/2022\/03\/imagemagick\/","title":{"rendered":"\u4f7f\u7528ImageMagick\u5bf9\u56fe\u7247\u8fdb\u884c\u4f18\u5316"},"content":{"rendered":"

\u4e00\u3001\u6982\u8ff0<\/h2>\n

\u56fe\u7247\u5728\u7f51\u7ad9\u6240\u5360\u7684\u6bd4\u91cd\u8d8a\u6765\u8d8a\u91cd\u3002\u8fd9\u91cc\u6240\u8bf4\u7684\u4f18\u5316\u662f\u6307\u5728\u4e0d\u5f71\u54cd\u7528\u6237\u4f53\u9a8c\u7684\u60c5\u51b5\u4e0b\uff0c\u5c06\u56fe\u7247\u505a\u5230\u6700\u5c0f\uff0c\u6709\u4e9b\u7f51\u7ad9\u4e0a\u7684\u56fe\u7247\u662f\u7528\u6237\u76f4\u63a5\u4e0a\u4f20\u7684\uff0c\u6709\u4e9b\u7528\u6237\u4f1a\u76f4\u63a5\u4e0a\u4f2010M\u7684\u539f\u56fe\uff0c\u5047\u5982\u4e00\u4e2a\u9875\u9762\u670910\u5f20\u56fe\u7247\uff0c\u90a3\u4e48\u8fd9\u4e2a\u9875\u9762\u6bcf\u5237\u65b0\u4e00\u6b21\u5c31\u8981\u6d88\u8017100M\u7684\u5e26\u5bbd\u6d41\u91cf\uff0c\u8fd9\u65e0\u7591\u662f\u4e2a\u5de8\u5927\u7684\u6d6a\u8d39\u3002<\/p>\n

\u5728\u5ba2\u6237\u7aef\u6211\u4eec\u53ef\u4ee5\u7528 PhotoShop \u7b49 GUI \u5de5\u5177\u5904\u7406\u56fe\u7247\uff0c\u4e0d\u8fc7\u5728\u670d\u52a1\u5668\u7aef\u8981\u5904\u7406\u6d77\u91cf\u7684\u56fe\u7247\u683c\u5f0f\u8f6c\u6362\uff0c\u7f29\u653e\u88c1\u526a\uff0c\u7ffb\u8f6c\u626d\u66f2\u7b49\u64cd\u4f5c\uff0c GUI \u8f6f\u4ef6\u5c31\u5f88\u96be\u4e0b\u624b\u4e86\uff0c\u6240\u4ee5\u6b64\u5904\u9700\u8981\u53ec\u5524\u547d\u4ee4\u884c\u5de5\u5177\u6765\u5e2e\u6211\u4eec\u5b8c\u6210\u8fd9\u4e9b\u4e8b\u3002<\/p>\n

ImageMagick: \u662f\u4e00\u6b3e\u521b\u5efa\u3001\u7f16\u8f91\u3001\u5408\u6210\uff0c\u8f6c\u6362\u56fe\u50cf\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u652f\u6301\u683c\u5f0f\u8d85\u8fc7 200 \u79cd\uff0c\u5305\u62ec\u5e38\u89c1\u7684 PNG, JPEG, GIF, HEIC, TIFF, DPX, EXR, WebP, Postscript, PDF, SVG \u7b49\u3002\u529f\u80fd\u5305\u62ec\u8c03\u6574\uff0c\u7ffb\u8f6c\uff0c\u955c\u50cf(mirror)\uff0c\u65cb\u8f6c\uff0c\u626d\u66f2\uff0c\u4fee\u526a\u548c\u53d8\u6362\u56fe\u50cf\uff0c\u8c03\u6574\u56fe\u50cf\u989c\u8272\uff0c\u5e94\u7528\u5404\u79cd\u7279\u6b8a\u6548\u679c\uff0c\u6216\u7ed8\u5236\u6587\u672c\uff0c\u7ebf\u6761\uff0c\u591a\u8fb9\u5f62\uff0c\u692d\u5706\u548c\u8d1d\u585e\u5c14\u66f2\u7ebf\u7b49\u3002<\/p>\n

\u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u6765\u4f7f\u7528ImageMagick\u6765\u5bf9\u56fe\u7247\u8fdb\u884c\u5206\u6790\u548c\u4f18\u5316\uff0c\u51cf\u5c11\u56fe\u7247\u6587\u4ef6\u5927\u5c0f\u3002<\/p>\n

\u4e8c\u3001ImageMagick\u7684\u5b89\u88c5<\/h2>\n

\u4ee5CentOS\u4e3a\u4f8b<\/p>\n

\n
 #\u5b89\u88c5\u5e38\u89c1\u56fe\u7247\u683c\u5f0f\u652f\u6301\n yum install libjpeg libjpeg-devel libpng libpng-devel libtiff libtiff-devel libungif libungif-devel freetype zlib -y\n #\u589e\u52a0webp\u683c\u5f0f\u652f\u6301\n yum install libwebp-tools -y\n #\u5b89\u88c5ImageMagick\n yum install ImageMagick  -y<\/code><\/pre>\n<\/div>\n

\u5b89\u88c5\u5b8c\u6210\u4ee5\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\/usr\/bin\/\u76ee\u5f55\u4e0b\u751f\u4ea7\u4e86animate\u3001compare\u3001composite\u3001conjure\u3001convert\u3001display\u3001identify\u3001import\u3001mogrify\u3001montage\u3001stream\u7b49\u6587\u4ef6\uff0c\u8fd9\u4e9b\u547d\u4ee4\u90fd\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\u3002<\/p>\n

\u4e09\u3001\u67e5\u770b\u56fe\u7247\u4fe1\u606f<\/h2>\n

\u518d\u8fdb\u884c\u4f18\u5316\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5bf9\u56fe\u7247\u8fdb\u884c\u4e00\u4e2a\u6574\u4f53\u7684\u4e86\u89e3\uff0cidentify\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u56fe\u7247\u7684\u4e00\u4e9b\u4fe1\u606f\u3002<\/p>\n

\n
# \u67e5\u770b\u56fe\u7247\u5bbd\u5ea6\u3001\u9ad8\u5ea6\u3001\u4f4d\u6df1\u3001\u5927\u5c0f\u4fe1\u606f\n[root@ipcpu.com root]# identify IMG20211022075834.jpg\nIMG20211022075834.jpg JPEG 4000x3000 4000x3000+0+0 8-bit sRGB 2.59941MiB 0.000u 0:00.000\n# \u4ec5\u663e\u793a\u56fe\u7247\u5bbd\u5ea6\u548c\u9ad8\u5ea6\n[root@ipcpu.com root]# identify -format \"%wx%h\" IMG20211022075834.jpg\n4000x3000\n# \u663e\u793a\u56fe\u7247\u8be6\u7ec6\u4fe1\u606f\uff08\u5305\u62ecEXIF\uff09\n[root@ipcpu.com root]# identify -verbose IMG20211022075834.jpg\nImage: IMG20211022075834.jpg\n  Format: JPEG (Joint Photographic Experts Group JFIF format)\n  Mime type: image\/jpeg\n  Class: DirectClass\n  Geometry: 4000x3000+0+0\n  Resolution: 72x72\n  Print size: 55.5556x41.6667\n  Units: PixelsPerInch\n  Colorspace: sRGB\n  Type: TrueColor\n<\u7701\u7565>\n  Compression: JPEG\n  Quality: 95\n  Orientation: TopLeft\n  Properties:\n    date:create: 2021-10-22T08:03:31+00:00\n    date:modify: 2021-10-22T08:03:18+00:00\n    exif:ApertureValue: 17\/10\n<\u7701\u7565>\n  Filesize: 2.59941MiB\n  Number pixels: 12000000\n  Pixels per second: 44.2019MB\n  User time: 0.220u<\/code><\/pre>\n<\/div>\n

\u56db\u3001\u53bb\u9664EXIF\u4fe1\u606f<\/h2>\n

EXIF\u662f\u56fe\u7247\u7684\u5143\u6570\u636e\uff0c\u6240\u8bb0\u5f55\u7684\u5143\u6570\u636e\u4fe1\u606f\u975e\u5e38\u4e30\u5bcc\uff0c\u4e3b\u8981\u5305\u542b\u4e86\u4ee5\u4e0b\u51e0\u7c7b\u4fe1\u606f\uff1a<\/p>\n

\u62cd\u6444\u4fe1\u606f\u3001\u62cd\u6444\u5668\u6750\uff08\u673a\u8eab\u3001\u955c\u5934\u3001\u95ea\u5149\u706f\u7b49\uff09\u3001\u62cd\u6444\u53c2\u6570\uff08\u5feb\u95e8\u901f\u5ea6\u3001\u5149\u5708F\u503c\u3001ISO\u901f\u5ea6\u3001\u7126\u8ddd\u3001\u6d4b\u5149\u6a21\u5f0f\u7b49\uff09\u3001\u56fe\u50cf\u5904\u7406\u53c2\u6570\uff08\u9510\u5316\u3001\u5bf9\u6bd4\u5ea6\u3001\u9971\u548c\u5ea6\u3001\u767d\u5e73\u8861\u7b49\uff09\u3001\u56fe\u50cf\u63cf\u8ff0\u53ca\u7248\u6743\u4fe1\u606f\u3001GPS\u5b9a\u4f4d\u6570\u636e\u3001\u7f29\u7565\u56fe\u3002 \u8fd8\u6709\u56fe\u7247\u7684\u65b9\u5411(\u65cb\u8f6c\u89d2\u5ea6)\u4e5f\u662f\u5b58\u50a8\u5728EXIF\u4e2d\u7684\u3002<\/p>\n

\u53bb\u9664EXIF\u4fe1\u606f\u5bf9\u4e8e\u56fe\u7247\u5927\u5c0f\u6765\u8bf4\u5f71\u54cd\u4e0d\u5927\uff0c\u53ef\u4ee5\u5ffd\u7565\u3002<\/p>\n

\n
[root@ipcpu.com root]# convert -strip IMG20211022075834.jpg new.jpg\n[root@ipcpu.com root]# ll  |grep .jpg\n-rw-r--r-- 1 root  root 2725684 Jul 21 16:03 IMG20211022075834.jpg\n-rw-r--r-- 1 root  root 2718697 Jul 21 16:10 new.jpg<\/code><\/pre>\n<\/div>\n

\u4e94\u3001\u901a\u8fc7\u8c03\u6574\u56fe\u7247\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u6765\u538b\u7f29\u56fe\u7247<\/h2>\n

\u6211\u4eec\u901a\u8fc7\u624b\u673a\u62cd\u7684\u7167\u7247\u6709\u7684\u53ef\u4ee5\u9ad8\u8fbe10M\uff0c\u5bbd\u548c\u9ad8\u662f4000x3000\uff0c\u53ef\u662f\u4e00\u822c\u6211\u4eec\u7684\u663e\u793a\u5668\u662f1920x1080(FHD)\u6216\u8005\u9ad8\u7aef\u76842560x1440(2.5K)\uff0c\u5f88\u660e\u663e\u663e\u793a\u4e0d\u4e86\u90a3\u4e48\u7ec6\u81f4\uff0c\u56e0\u6b64\u6211\u4eec\u8981\u628a\u56fe\u7247\u5bbd\u5ea6\u548c\u9ad8\u5ea6\u7f29\u5c0f\uff0c\u4ee5\u4fbf\u4e8e\u8282\u7701\u7a7a\u95f4\u548c\u5e26\u5bbd\u3002<\/p>\n

\n
convert -resize \"1920x1080>\" IMG20211022075834.jpg resize.webp<\/code><\/pre>\n<\/div>\n

\u5e38\u7528\u7684\u7ec4\u5408\u65b9\u6cd5\u6709\uff1a<\/p>\n

\n
\u5047\u8bbe\u539f\u56fe\u662f400*300\n50%        \u6309\u716750%\u6bd4\u4f8b\u8fdb\u884c\u7f29\u653e\uff0c(\u65b0\u56fe200*150)\n100             \u6309\u6307\u5b9a\u7684\u5bbd\u5ea6\u7f29\u653e\uff0c\u5bbd\u9ad8\u6bd4\u4e0d\u53d8\uff0c(\u65b0\u56fe100*75)\n x500          \u6309\u6307\u5b9a\u9ad8\u5ea6\u7f29\u653e\uff0c\u5bbd\u9ad8\u6bd4\u4e0d\u53d8\uff0c(\u65b0\u56fe667*500)\n100x100      \u7ed9\u5b9a\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u6700\u9ad8\u503c\uff0c\u5bbd\u9ad8\u6bd4\u4e0d\u53d8\uff0c(\u65b0\u56fe100*75)\n100x100^     \u7ed9\u5b9a\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u6700\u4f4e\u503c\uff0c\u5bbd\u9ad8\u6bd4\u4e0d\u53d8\uff0c(\u65b0\u56fe133*100)\n100x100!      \u5bbd\u5ea6\u548c\u9ad8\u5ea6\u5f3a\u5236\u8f6c\u6362\uff0c\u5ffd\u7565\u5bbd\u9ad8\u6bd4\uff0c(\u65b0\u56fe100*100)\n400x200>     \u7f29\u5c0f\u56fe\u7247\uff0c\u5f53\u56fe\u7247\u5bbd\u6216\u9ad8\u8d85\u8fc7\u89c4\u5b9a\u7684\u5c3a\u5bf8\uff0c\u7ed9\u5b9a\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u6700\u4f4e\u503c\uff0c\u5bbd\u9ad8\u6bd4\u4e0d\u53d8\n100x100^>   \u7f29\u5c0f\u56fe\u7247\uff0c\u5f53\u56fe\u7247\u5bbd\u6216\u9ad8\u8d85\u8fc7\u89c4\u5b9a\u7684\u5c3a\u5bf8\uff0c \u7ed9\u5b9a\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u6700\u9ad8\u503c\uff0c\u5bbd\u9ad8\u6bd4\u4e0d\u53d8\n800x500<     \u653e\u5927\u56fe\u7247\uff0c\u5f53\u56fe\u7247\u5bbd\u6216\u9ad8\u5c0f\u4e8e\u89c4\u5b9a\u7684\u5c3a\u5bf8\u3002\u7ed9\u5b9a\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u6700\u4f4e\u503c\uff0c\u5bbd\u9ad8\u6bd4\u4e0d\u53d8\n700x600^<   \u653e\u5927\u56fe\u7247\uff0c\u5f53\u56fe\u7247\u5bbd\u6216\u9ad8\u5c0f\u4e8e\u89c4\u5b9a\u7684\u5c3a\u5bf8\u3002\u7ed9\u5b9a\u9ad8\u5ea6\u548c\u5bbd\u5ea6\u7684\u6700\u9ad8\u503c\uff0c\u5bbd\u9ad8\u6bd4\u4e0d\u53d8<\/code><\/pre>\n<\/div>\n

\u5b9e\u9645\u6848\u4f8b\uff0c\u5148\u770b\u4e0b\u7f29\u5c0f\u56fe\u7247<\/p>\n

\n
# \u7f29\u5c0f\u56fe\u7247\n[root ]# convert -resize '180x150>' 400x300.jpg last.jpg && identify -format \"%wx%h\" last.jpg\n180x135\n[root ]# convert -resize '210x150>' 400x300.jpg last.jpg && identify -format \"%wx%h\" last.jpg\n200x150\n\n\u539f\u56fe\u662f400x300, \u6309\u7167180x150(\u5bbd\u548c\u9ad8\u5206\u522b\u662f\u539f\u5927\u5c0f\u768445%\u548c50%)\u8fdb\u884c\u7f29\u5c0f\uff0c \u7ed9\u5b9a\u6700\u4f4e\u503c\uff0c\u4e5f\u5c31\u662f45%\u5bbd\u5ea6\uff0c\u6240\u4ee5\u51fa\u6765\u7684\u65b0\u56fe\u7247\u5bbd\u548c\u9ad8\u662f180x135\u3002\n\u539f\u56fe\u662f400x300, \u6309\u7167210x150(\u5bbd\u548c\u9ad8\u5206\u522b\u662f\u539f\u5927\u5c0f\u768452%\u548c50%)\u8fdb\u884c\u7f29\u5c0f\uff0c \u7ed9\u5b9a\u6700\u4f4e\u503c\uff0c\u4e5f\u5c31\u662f50%\u9ad8\u5ea6\uff0c\u6240\u4ee5\u51fa\u6765\u7684\u65b0\u56fe\u7247\u5bbd\u548c\u9ad8\u662f200x150\u3002\n\n\n[root ]# convert -resize '180x150^>' 400x300.jpg last.jpg && identify -format \"%wx%h\" last.jpg\n200x150\n[root ]# convert -resize '210x150^>' 400x300.jpg last.jpg && identify -format \"%wx%h\" last.jpg\n210x158\n\n\u539f\u56fe\u662f400x300, \u6309\u7167180x150(\u5bbd\u548c\u9ad8\u5206\u522b\u662f\u539f\u5927\u5c0f\u768445%\u548c50%)\u8fdb\u884c\u7f29\u5c0f\uff0c \u7ed9\u5b9a\u6700\u9ad8\u503c\uff0c\u4e5f\u5c31\u662f50%\u9ad8\u5ea6\uff0c\u6240\u4ee5\u51fa\u6765\u7684\u65b0\u56fe\u7247\u5bbd\u548c\u9ad8\u662f200x150\u3002\n\u539f\u56fe\u662f400x300, \u6309\u7167210x150(\u5bbd\u548c\u9ad8\u5206\u522b\u662f\u539f\u5927\u5c0f\u768452%\u548c50%)\u8fdb\u884c\u7f29\u5c0f\uff0c \u7ed9\u5b9a\u6700\u9ad8\u503c\uff0c\u4e5f\u5c31\u662f52%\u5bbd\u5ea6\uff0c\u6240\u4ee5\u51fa\u6765\u7684\u65b0\u56fe\u7247\u5bbd\u548c\u9ad8\u662f210x158\u3002<\/code><\/pre>\n<\/div>\n

\u518d\u6765\u770b\u4e0b\u653e\u5927\u56fe\u7247<\/p>\n

\n
# \u653e\u5927\u56fe\u7247\n[root ]# convert -resize '800x500<' 400x300.jpg last.jpg && identify -format \"%wx%h\" last.jpg\n667x500\n[root ]# convert -resize '800x700<' 400x300.jpg last.jpg && identify -format \"%wx%h\" last.jpg\n800x600\n\n\u539f\u56fe\u662f400x300, \u6309\u7167800x500(\u5bbd\u548c\u9ad8\u5206\u522b\u662f\u539f\u5927\u5c0f\u7684200%\u548c166%)\u8fdb\u884c\u653e\u5927\uff0c \u7ed9\u5b9a\u6700\u4f4e\u503c\uff0c\u4e5f\u5c31\u662f166%\u9ad8\u5ea6\uff0c\u6240\u4ee5\u51fa\u6765\u7684\u65b0\u56fe\u7247\u5bbd\u548c\u9ad8\u662f667x500\u3002\n\u539f\u56fe\u662f400x300, \u6309\u7167800x700(\u5bbd\u548c\u9ad8\u5206\u522b\u662f\u539f\u5927\u5c0f\u7684200%\u548c233%)\u8fdb\u884c\u653e\u5927\uff0c \u7ed9\u5b9a\u6700\u4f4e\u503c\uff0c\u4e5f\u5c31\u662f200%\u5bbd\u5ea6\uff0c\u6240\u4ee5\u51fa\u6765\u7684\u65b0\u56fe\u7247\u5bbd\u548c\u9ad8\u662f800x600\u3002\n\n[root ]# convert -resize '800x500^<' 400x300.jpg last.jpg && identify -format \"%wx%h\" last.jpg\n800x600\n[root ]# convert -resize '800x700^<' 400x300.jpg last.jpg && identify -format \"%wx%h\" last.jpg\n933x700\n\n\u539f\u56fe\u662f400x300, \u6309\u7167800x500(\u5bbd\u548c\u9ad8\u5206\u522b\u662f\u539f\u5927\u5c0f\u7684200%\u548c166%)\u8fdb\u884c\u653e\u5927\uff0c \u7ed9\u5b9a\u6700\u9ad8\u503c\uff0c\u4e5f\u5c31\u662f200%\u5bbd\u5ea6\uff0c\u6240\u4ee5\u51fa\u6765\u7684\u65b0\u56fe\u7247\u5bbd\u548c\u9ad8\u662f800x600\u3002\n\u539f\u56fe\u662f400x300, \u6309\u7167800x700(\u5bbd\u548c\u9ad8\u5206\u522b\u662f\u539f\u5927\u5c0f\u7684200%\u548c233%)\u8fdb\u884c\u653e\u5927\uff0c \u7ed9\u5b9a\u6700\u9ad8\u503c\uff0c\u4e5f\u5c31\u662f233%\u9ad8\u5ea6\uff0c\u6240\u4ee5\u51fa\u6765\u7684\u65b0\u56fe\u7247\u5bbd\u548c\u9ad8\u662f933x700\u3002<\/code><\/pre>\n<\/div>\n

\u4e94\u3001\u901a\u8fc7\u964d\u4f4e\u56fe\u7247\u7684quality\u54c1\u8d28\u6765\u538b\u7f29\u56fe\u7247<\/h2>\n

\u5bf9\u4e8e\u597d\u591a\u9ad8\u8d28\u91cf\u7684\u56fe\u7247\uff0c\u964d\u4f4e\u56fe\u7247\u7684quality\u54c1\u8d28\uff0c\u53ef\u4ee5\u660e\u663e\u51cf\u5c11\u56fe\u7247\u7684\u5927\u5c0f\uff0c\u4f8b\u598285%\u7684\u54c1\u8d28\u5bf9\u4e8e\u8089\u773c\u6765\u8bf4\u5f88\u96be\u5206\u8fa8\uff0c\u518d\u52a0\u4e0a\u751f\u6210\u7684\u56fe\u7247\u5927\u90e8\u5206\u662f\u7528\u4e8eWEB\u4f20\u8f93\u5c55\u793a\u800c\u975e\u6253\u5370\uff0c\u53d8\u66f4\u54c1\u8d28\u548c\u5927\u5c0f\u5c31\u662f\u56fe\u7247\u4f18\u5316\u7684\u4e24\u5927\u624b\u6bb5\u3002<\/p>\n

\n
[root ]#  convert  -quality 85 orignal.jpg orignal-85.jpg\n[root ]#  ll -h |grep orignal\n-rw-r--r-- 1 root  root 1.3M Jul 22 12:44 orignal-85.jpg\n-rw-r--r-- 1 root  root 2.6M Jul 21 16:03 orignal.jpg<\/code><\/pre>\n<\/div>\n

\u54c1\u8d28\u53c2\u6570\u548c\u5927\u5c0f\u53c2\u6570\u53ef\u4ee5\u4e00\u8d77\u4f7f\u7528<\/p>\n

\n
[root ]#   convert  -quality 85  -resize '1920x1280^>' orignal.jpg orignal-85-re.jpg\n[root ]#   ll -h |grep orignal\n-rw-r--r-- 1 root  root 1.3M Jul 22 12:44 orignal-85.jpg\n-rw-r--r-- 1 root  root 296K Jul 22 12:48 orignal-85-re.jpg\n-rw-r--r-- 1 root  root 2.6M Jul 21 16:03 orignal.jpg<\/code><\/pre>\n<\/div>\n

\u6548\u679c\u662f\u4e0d\u662f\u5f88\u660e\u663e\uff1f<\/p>\n

\u516d\u3001\u901a\u8fc7\u5c06\u56fe\u7247\u8f6c\u6362\u4e3awebp\u683c\u5f0f\u51cf\u5c11\u6587\u4ef6\u5927\u5c0f<\/h2>\n

WebP \u662f Google \u7684\u4e00\u79cd\u53ef\u4ee5\u540c\u65f6\u63d0\u4f9b\u6709\u635f\u538b\u7f29\uff08\u50cf JPEG \u4e00\u6837\uff09\u548c\u900f\u660e\u5ea6\uff08\u50cf PNG \u4e00\u6837\uff09\u7684\u56fe\u7247\u6587\u4ef6\u683c\u5f0f\uff0c\u4e0d\u8fc7\u4e0e JPEG \u6216 PNG \u76f8\u6bd4\uff0c\u8fd9\u79cd\u683c\u5f0f\u53ef\u4ee5\u63d0\u4f9b\u66f4\u597d\u7684\u538b\u7f29\u3002
\n\u4e0d\u8fc7\u6709\u4e9b\u65e7\u7684\u5ba2\u6237\u7aef\u6d4f\u89c8\u5668\u662f\u4e0d\u652f\u6301\u7684\uff0c\u5982\u4e0b\u56fe\uff0c\u7eff\u8272\u90e8\u5206\u7684\u8f6f\u4ef6\u7248\u672c\u662f\u5b8c\u5168\u652f\u6301web\u683c\u5f0f\u7684\u3002
\n<\/p>\n

\u8f6c\u6362\u6210webp\u683c\u5f0f<\/p>\n

\n
[root ]#  convert  -quality 85  -resize '1920x1280^>' orignal.jpg orignal-85-re.webp\n[root ]# \n[root ]#  ll -h |grep orignal\n-rw-r--r-- 1 root  root 1.3M Jul 22 12:44 orignal-85.jpg\n-rw-r--r-- 1 root  root 296K Jul 22 12:48 orignal-85-re.jpg\n-rw-r--r-- 1 root  root  87K Jul 22 12:51 orignal-85-re.webp\n-rw-r--r-- 1 root  root 2.6M Jul 21 16:03 orignal.jpg<\/code><\/pre>\n<\/div>\n

\u6211\u4eec\u53ef\u4ee5\u770b\u5230\uff0c\u540c\u6837\u7684\u54c1\u8d28\u548c\u5bbd\u9ad8\u6570\uff0cjpg\u683c\u5f0f\u662f296K\uff0cweb\u683c\u5f0f\u53ea\u670987K\u3002\u771f\u7684\u5f88\u5c0f\u3002<\/p>\n

\u53c2\u8003\u8d44\u6599<\/h2>\n

https:\/\/www.imagemagick.org\/script\/command-line-processing.php<\/a><\/p>\n

\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1aIPCPU-\u7f51\u7edc\u4e4b\u8def<\/a> » \u4f7f\u7528ImageMagick\u5bf9\u56fe\u7247\u8fdb\u884c\u4f18\u5316<\/a><\/p>","protected":false},"excerpt":{"rendered":"

\u4e00\u3001\u6982\u8ff0 \u56fe\u7247\u5728\u7f51\u7ad9\u6240\u5360\u7684\u6bd4\u91cd\u8d8a\u6765\u8d8a\u91cd\u3002\u8fd9\u91cc\u6240\u8bf4\u7684\u4f18\u5316\u662f\u6307\u5728\u4e0d\u5f71\u54cd\u7528\u6237\u4f53\u9a8c\u7684\u60c5\u51b5\u4e0b\uff0c\u5c06\u56fe\u7247\u505a\u5230\u6700\u5c0f\uff0c\u6709\u4e9b\u7f51\u7ad9\u4e0a\u7684\u56fe\u7247\u662f\u7528\u6237\u76f4\u63a5\u4e0a\u4f20\u7684\uff0c\u6709\u4e9b\u7528\u6237\u4f1a\u76f4\u63a5\u4e0a\u4f2010M\u7684\u539f\u56fe\uff0c\u5047\u5982\u4e00\u4e2a\u9875\u9762\u670910\u5f20\u56fe\u7247\uff0c\u90a3\u4e48\u8fd9\u4e2a\u9875\u9762\u6bcf\u5237\u65b0\u4e00\u6b21\u5c31\u8981\u6d88\u8017100M\u7684\u5e26\u5bbd\u6d41\u91cf\uff0c\u8fd9\u65e0\u7591\u662f\u4e2a\u5de8\u5927\u7684\u6d6a\u8d39\u3002 \u5728\u5ba2\u6237\u7aef\u6211\u4eec\u53ef\u4ee5\u7528 PhotoShop \u7b49 GUI \u5de5\u5177\u5904\u7406\u56fe\u7247\uff0c\u4e0d\u8fc7\u5728\u670d\u52a1\u5668\u7aef\u8981\u5904\u7406\u6d77\u91cf\u7684\u56fe\u7247\u683c\u5f0f\u8f6c\u6362\uff0c\u7f29\u653e\u88c1\u526a\uff0c\u7ffb\u8f6c\u626d\u66f2\u7b49\u64cd\u4f5c\uff0c GUI \u8f6f\u4ef6\u5c31\u5f88\u96be\u4e0b\u624b\u4e86\uff0c\u6240\u4ee5\u6b64\u5904\u9700\u8981\u53ec\u5524\u547d\u4ee4\u884c\u5de5\u5177\u6765\u5e2e\u6211\u4eec\u5b8c\u6210\u8fd9\u4e9b\u4e8b\u3002 ImageMagick: \u662f\u4e00\u6b3e\u521b\u5efa\u3001\u7f16\u8f91\u3001\u5408\u6210\uff0c\u8f6c\u6362\u56fe\u50cf\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u652f\u6301\u683c\u5f0f\u8d85\u8fc7 200 \u79cd\uff0c\u5305\u62ec\u5e38\u89c1\u7684 PNG, JPEG, GIF, HEIC, TIFF, DPX, EXR, WebP, Postscript, PDF, SVG \u7b49\u3002\u529f\u80fd\u5305\u62ec\u8c03\u6574\uff0c\u7ffb\u8f6c\uff0c\u955c\u50cf(mirror)\uff0c\u65cb\u8f6c\uff0c\u626d\u66f2\uff0c\u4fee\u526a\u548c\u53d8\u6362\u56fe\u50cf\uff0c\u8c03\u6574\u56fe\u50cf\u989c\u8272\uff0c\u5e94\u7528\u5404\u79cd\u7279\u6b8a\u6548\u679c\uff0c\u6216\u7ed8\u5236\u6587\u672c\uff0c\u7ebf\u6761\uff0c\u591a\u8fb9\u5f62\uff0c\u692d\u5706\u548c\u8d1d\u585e\u5c14\u66f2\u7ebf\u7b49\u3002 \u63a5\u4e0b\u6765\uff0c\u6211\u4eec\u6765\u4f7f\u7528ImageMagick\u6765\u5bf9\u56fe\u7247\u8fdb\u884c\u5206\u6790\u548c\u4f18\u5316\uff0c\u51cf\u5c11\u56fe\u7247\u6587\u4ef6\u5927\u5c0f\u3002 \u4e8c\u3001ImageMagick\u7684\u5b89\u88c5 \u4ee5CentOS\u4e3a\u4f8b #\u5b89\u88c5\u5e38\u89c1\u56fe\u7247\u683c\u5f0f\u652f\u6301 yum install libjpeg libjpeg-devel libpng libpng-devel libtiff libtiff-devel libungif libungif-devel freetype zlib -y #\u589e\u52a0webp\u683c\u5f0f\u652f\u6301 yum install libwebp-tools -y #\u5b89\u88c5ImageMagick yum install ImageMagick -y \u5b89\u88c5\u5b8c\u6210\u4ee5\u540e\uff0c\u6211\u4eec\u53ef\u4ee5\u770b\u5230\/usr\/bin\/\u76ee\u5f55\u4e0b\u751f\u4ea7\u4e86animate\u3001compare\u3001composite\u3001conjure\u3001convert\u3001display\u3001identify\u3001import\u3001mogrify\u3001montage\u3001stream\u7b49\u6587\u4ef6\uff0c\u8fd9\u4e9b\u547d\u4ee4\u90fd\u53ef\u4ee5\u76f4\u63a5\u8c03\u7528\u3002 \u4e09\u3001\u67e5\u770b\u56fe\u7247\u4fe1\u606f \u518d\u8fdb\u884c\u4f18\u5316\u4e4b\u524d\uff0c\u6211\u4eec\u9700\u8981\u5bf9\u56fe\u7247\u8fdb\u884c\u4e00\u4e2a\u6574\u4f53\u7684\u4e86\u89e3\uff0cidentify\u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u56fe\u7247\u7684\u4e00\u4e9b\u4fe1\u606f\u3002 […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,13],"tags":[236,235],"_links":{"self":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1608"}],"collection":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/comments?post=1608"}],"version-history":[{"count":1,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1608\/revisions"}],"predecessor-version":[{"id":1609,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/posts\/1608\/revisions\/1609"}],"wp:attachment":[{"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/media?parent=1608"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/categories?post=1608"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c.ipcpu.com\/wp-json\/wp\/v2\/tags?post=1608"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}