나는 이것을 테스트하지 못했지만,이처럼 "convert_options"매개 변수를 사용할 수 있어야합니다 :
:convert_options => { :all => ‘-colorspace Gray’ }
내가 PERSONNALY 내 자신의 프로세서를 사용
https://github.com/thoughtbot/paperclip/blob/master/lib/paperclip/thumbnail.rb
에서보세요. 이 간단한 그레이 스케일 변환을위한 100 % 필요하지 않을 수도 있습니다
module Paperclip
# Handles grayscale conversion of images that are uploaded.
class Grayscale < Processor
def initialize file, options = {}, attachment = nil
super
@format = File.extname(@file.path)
@basename = File.basename(@file.path, @format)
end
def make
src = @file
dst = Tempfile.new([@basename, @format])
dst.binmode
begin
parameters = []
parameters << ":source"
parameters << "-colorspace Gray"
parameters << ":dest"
parameters = parameters.flatten.compact.join(" ").strip.squeeze(" ")
success = Paperclip.run("convert", parameters, :source => "#{File.expand_path(src.path)}[0]", :dest => File.expand_path(dst.path))
rescue PaperclipCommandLineError => e
raise PaperclipError, "There was an error during the grayscale conversion for #{@basename}" if @whiny
end
dst
end
end
end
,하지만 작동합니다 lib에
has_attached_file :logo,
:url => PaperclipAssetsController.config_url,
:path => PaperclipAssetsController.config_path,
:styles => {
:grayscale => { :processors => [:grayscale] }
}
: 모델에서
!
죄송합니다, 감사 :
또는 당신이 선호하는 경우 링크
! – jyoseph전환 옵션 ': == { "gray =>"450x250 "}에 convert_options => {: gray =>"-blur 0x8 "}'을 추가하는 것이 더 쉽습니다. – Ben