【问题标题】:Install Rmagick with default 8 bits使用默认 8 位安装 Rmagick
【发布时间】:2014-01-08 18:43:52
【问题描述】:

默认情况下,Rmagick(基于 ImageMagick)使用--with-quantum-depth=16(每通道 16 位)构建。这对我的应用程序来说不是必需的,而且我看不到如何安装 Rmagick/ImageMagick 并使其每个通道仅使用 8 位。

我愿意使用 Gemfile 在我的本地机器 (Ubuntu 12.04) 和 Heroku 上安装它。

【问题讨论】:

  • 不就是./configure --with-quantum-depth=8ImageMagick吗?
  • 我猜是在安装 Rmagick 时安装了 ImageMagick。我没有在 Heroku 上手动安装 ImageMagick...

标签: ruby heroku gem imagemagick rmagick


【解决方案1】:

Quantum depth 在构建时定义,但可以在运行时动态调整。请参阅 ImageMagick 中的 -depth 8 选项和 RMagick 中的 self.depth = 8

img = Image.new(123,321) {
     self.depth = 8
}

【讨论】:

  • 你知道如何将它保存到 8 位吗?假设我操作了几个图像并且我不确定有多少位,直到我保存时我想只用八位保存它。使用 ImageMagick 你可以做 -colors 255,你知道 Rmagick 吗?
  • This answer 可能是您更好的解决方案。如果 Ruby 中的一切都是一个对象,只需子类化 Magick 模块,做你需要的,然后走开。否则,设置-colors 只是另一个image attribute
猜你喜欢
  • 2017-10-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-21
  • 1970-01-01
  • 2015-01-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多