문제

I'd like to know how to convert png and gif files with alpha channel to jpg with white background with paperclip

I tried this but, it doesn't work

has_attached_file( 
  :photo, 
  :whiny => false, 
  :styles => { 
    :medium => ["300x300>", :jpg], 
    :thumb => ["100x100>", :jpg] 
  }, 
  :convert_options => { :all => '-alpha white -background white'}
)

It saves the file with the gray background.

도움이 되었습니까?

해결책

-alpha remove -background white is preferable. white is not a valid argument for -alpha.

다른 팁

here the solution

has_attached_file :photo,
  :styles => {
    :medium => ["300x300>",:jpg],
    :thumb => ["100x100>", :jpg]
  },
  :convert_options => {
    :all => '-background white -flatten +matte'
  }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top