imagemagick中从png到jpg的透明背景

发布于 2024-12-14 12:15:02 字数 303 浏览 3 评论 0原文

我在 image magick 中将一些 png 图像制作成圆角。但是当我尝试将所有 png 图像制作成 JPG 格式时,圆角背景转换为白色,我希望圆角应该是透明的。我正在使用这些命令使它们透明,但没有得到任何好的结果。

1. convert image.png -background white -flatten -alpha off image.jpg
2. convert image.png -background none -flatten -alpha off image.jpg

任何帮助和建议都将非常感激。

I made some png images into round corner in image magick .But when I tried to make all the png images into JPG format, the round corner background is converting into white and I want the round corner should be in transparent.I am using these commands to make them transparent but not getting any good results.

1. convert image.png -background white -flatten -alpha off image.jpg
2. convert image.png -background none -flatten -alpha off image.jpg

Any help and suggestions will be highly appreciable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

云醉月微眠 2024-12-21 12:15:02

Jpg 不能是透明的,只能是 gif 和 png(也可以是 svgs),因此它将用白色像素填充透明区域。

Jpgs cannot be transparent, only gifs and pngs (ok svgs too) so it will fill with white pixels in for transparent areas.

没︽人懂的悲伤 2024-12-21 12:15:02

简单的答案是你做不到。 JPEG 格式根本不支持透明度。您必须将图像保留为 PNG 格式(或将它们转换为 GIF - 但为什么要这样做呢?)

The simple answer is you cannot do it. JPEG format simply does not support transparency. You have to leave the images in PNG format (or conver them to GIF - but why would you do that?)

狼亦尘 2024-12-21 12:15:02

JPG 不支持任何形式的透明度。如果您想要透明度,则必须使用 PNG。

JPG does not support transparency in any form whatsoever. If you want transparency, you'll have to use PNG.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文