Ruby on rails 回形针Gem无法转换PNG文件

Ruby on rails 回形针Gem无法转换PNG文件,ruby-on-rails,imagemagick,paperclip,Ruby On Rails,Imagemagick,Paperclip,尝试上载PNG文件时出错。它们在大小转换过程中失败(相同图像工作的JPG) 因此,您可以看到它在尝试转换时立即失败。在我的模型中: has_attached_file :picture, styles: {tiny: ["40x40#", :jpg], square_thumb: "100x100#", thumb: "100x100>", square: "300x300#", medium: "300x300>", large: "60

尝试上载PNG文件时出错。它们在大小转换过程中失败(相同图像工作的JPG)

因此,您可以看到它在尝试转换时立即失败。在我的模型中:

  has_attached_file :picture,
                    styles: {tiny: ["40x40#", :jpg], square_thumb: "100x100#", thumb: "100x100>", square: "300x300#", medium: "300x300>", large: "600x600>", xlarge: '1000x1000>'},
                    convert_options: {thumb: "-quality 95 -strip", medium: "-quality 95 -strip", tiny: "-quality -95 -strip", square_thumb:"-quality -95 -strip", square:"-quality -95 -strip"  },
                    url: "/system/:class/:id/headshot_:hash.:extension",
                    hash_secret: ENV['DOC_SECRET']

  validates_attachment :picture, presence: true,
                       content_type: { content_type: /\Aimage/ },
                       size: { less_than: 3.megabytes }
注意,我在调试时更改了
tiny
转换,以将PNG转换为JPG,现在,每当我上传PNG时,
tiny
转换工作正常,下一个转换失败

这在生产和开发过程中都会发生,所以要么我设置了错误,要么是回形针问题。我不相信这是ImageMagick的问题,除非我和Heroku(生产服务器)都有同样的问题。顺便说一句,强制转换为PNG--
[“40X40#,:PNG]
也会失败

我想我可以强制将每个图像转换为JPG,对于这个应用程序来说,这不是什么大问题,但我宁愿找出根本问题并加以解决

另一个注意事项是,我也尝试了
tiny:“40x40>”
,但也失败了。我能让转换工作的唯一方法是强制将格式更改为非PNG格式。我使用的是回形针版本5.1.0

更新: 删除
tiny:“-quality-95-strip”,
允许转换工作——所以问题就出在那里。我必须用完,但我猜质量转换不适用于PNG文件

  has_attached_file :picture,
                    styles: {tiny: ["40x40#", :jpg], square_thumb: "100x100#", thumb: "100x100>", square: "300x300#", medium: "300x300>", large: "600x600>", xlarge: '1000x1000>'},
                    convert_options: {thumb: "-quality 95 -strip", medium: "-quality 95 -strip", tiny: "-quality -95 -strip", square_thumb:"-quality -95 -strip", square:"-quality -95 -strip"  },
                    url: "/system/:class/:id/headshot_:hash.:extension",
                    hash_secret: ENV['DOC_SECRET']

  validates_attachment :picture, presence: true,
                       content_type: { content_type: /\Aimage/ },
                       size: { less_than: 3.megabytes }