Question

Je voudrais savoir comment convertir les fichiers PNG et GIF avec canal alpha en jpg avec fond blanc avec paperclip

J'ai essayé, mais ça ne fonctionne pas

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

Il enregistre le fichier avec le fond gris.

Était-ce utile?

La solution

-alpha remove -background white est préférable. white n'est pas un argument valable pour -alpha.

Autres conseils

ici la solution

has_attached_file :photo,
  :styles => {
    :medium => ["300x300>",:jpg],
    :thumb => ["100x100>", :jpg]
  },
  :convert_options => {
    :all => '-background white -flatten +matte'
  }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top