我想知道如何PNG和GIF文件轉換成帶alpha通道的JPG白色背景回形針回形針圖像保存爲JPG白色背景
我嘗試這樣做,但它不工作
has_attached_file:photo::whiny => false,:styles => {:medium => [「300x300>」,:jpg],:thumb => [「100x100>」,:jpg]},:convert_options => {所有=>「白-α白-background」}
它節省了帶有灰色背景的文件 感謝
我想知道如何PNG和GIF文件轉換成帶alpha通道的JPG白色背景回形針回形針圖像保存爲JPG白色背景
我嘗試這樣做,但它不工作
has_attached_file:photo::whiny => false,:styles => {:medium => [「300x300>」,:jpg],:thumb => [「100x100>」,:jpg]},:convert_options => {所有=>「白-α白-background」}
它節省了帶有灰色背景的文件 感謝
-alpha remove -background white
是優選的。 white
不是-alpha
的有效參數。
這裏的解決方案
has_attached_file :photo,
:styles => {
:medium => ["300x300>",:jpg],
:thumb => ["100x100>", :jpg]
},
:convert_options => {
:all => '-background white -flatten +matte'
}
謝謝!它可以幫助我很多:) – 2013-10-03 07:46:03
它可能會調整圖像的方式,而不是你想要的方式,建議形式@Pat McGee對我更好 – antpaw 2014-05-15 12:08:17
同樣對我來說,@Pat McGee的回答是正確的!這與裁剪/擴展一起使用時帶來了很多問題 – 2015-07-08 16:00:01