问题标签 [rmagick]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
ruby - rmagick 自动缩放比例
有没有办法让我在 rmagick 中缩放和图像,我设置宽度和高度自动缩放以使图像包含相同的比例?
ruby-on-rails - Ruby Tempfile 的 RMagick/ImageMagick 错误“没有此图像格式的解码委托”
我在使用 RMagick/ImageMagick 打开通过 Rails 表单上传的文件时遇到问题。我相信这是因为 Rails Tempfile 行为是为了消除文件扩展名。根据我的阅读,ImageMagick 应该更喜欢使用幻数而不是文件扩展名来检测图像文件格式,但在我的安装中似乎并非如此。我正在这样做:
其中 full_size_image 是从上传表单控制器返回的 Tempfile 对象,这会产生如下错误:
此图像格式没有解码委托 `/var/folders/uI/uIsldaxoHkiXKWYFuTWs4++++TI/-Tmp-/RackMultipart20101031-10144-1hiwlw-0'@error/constitute.c/ReadImage/532
这发生在带有 Rails 2.3.8、RMagick 2.13.1 和 ImageMagick 6.6.5-5 的 Mac OS X 10.6 上。我已经确认 ImageMagick 可以通过上传表单成功转换我一直用来测试的文件,并且临时文件路径/文件实际存在/可读。
我怀疑a)我的ImageMagick安装中的某些东西以某种方式阻止它使用幻数来检测文件类型(??-让ImageMagick从源头上在Snow Leopard上工作本身就是一种冒险)或b)只有这种情况不起作用,我需要以某种方式使 Tempfile 保留原始文件扩展名。
我知道我可以从 Tempfile 对象中获取原始文件名,但我还没有找到重命名文件的方法。我想我可以在我使用 File 对象的地方做一些杂乱无章的事情,并以某种方式创建一个带有原始扩展名的 Tempfile 副本,但这似乎不合时宜。解决这个问题的正确方法是什么?
谢谢你的帮助。
php - 了解 ImageMagick 的转换和翻译为 Ruby RMagick
我未能将以下 PHP/ImageMagick 代码翻译成 Ruby RMagick(以使其对未来的用户更易于管理并了解它的实际作用):
到目前为止,我认为我或多或少地理解了 convert-command 的作用,但是将其翻译为 RMagick 让我重新思考了这一点。
例如:为什么$output[0] != 1
有时 true
在$myDir
PNGs 上,但 RMagickImage.alpha?
总是在 true
PNGs上$myDir
?我错过了什么吗?
我认为让我回到正轨的最好方法是,如果有人可以向我解释 convert-command 到底在做什么(包括表达式%[fx:u.a]
)。
更新:与此同时,我已经编写了需要此信息的脚本。如果对您有任何帮助,您可以在 Github上查看。
imagemagick - 从 8.04 升级后,RMagick 在 Ubuntu 10.04 上损坏
我最近将一台服务器从 Ubuntu 8.04 升级到 10.04,它似乎破坏了 RMagick,出现以下错误:
libWand.so.10:无法打开共享对象文件:没有这样的文件或目录 - /opt/ruby-enterprise-1.8.7-2009.10/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick2 。所以
在网上四处寻找想法,我决定尝试将其符号链接到 libMagickCore.so.2.0.1,并将 libWand.so.10 符号链接到 libMagickWand.so.2.0.1。这给了我一个新的错误:
此 RMagick 安装配置了 ImageMagick 6.3.7,但 ImageMagick 6.5.7-8 正在使用中。
从那以后,我一直在尝试各种谷歌搜索、卸载和重新安装 RMagick 和各种 ImageMagick 库,但没有运气。我认为某些库可能是从源代码构建的,或者是由以前的员工“手动”安装的。
---(后来补充:)
似乎 RMagick 2.13.0 或 2.13.1 已修复为与 ImageMagick 6.5.7 一起使用,但是当我尝试将其中一个版本指定为 gem install 时,它要么:(a)似乎安装,但只有 2.12。 2 出现在“宝石列表”中,我的 rails 应用程序只加载了 2.12.2;(b) 如果我指定 2.13.0,则出现错误“错误:在任何存储库中都找不到有效的 gem 'rmagick' (= 2.13.0)”。“gem -v”表示 1.3.5。
- -(然后:)
如此处所述将 RUbyGems 更新到 1.3.7:http ://wiki.joyent.com/all-accelerators:kb:rubygems没有改变任何东西。
macos - 在 Mac OS X 上安装 Rmagick 时出错
我跟着RMagick for OSX 的安装: http ://rmagick.rubyforge.org/install-faq.html#osx
我已经完成了John Maddux的Imagemagick安装(在 OSX 上安装ImageMagick而不使用MacPorts的解决方案)
这是我的终端窗口:
非常感谢您的帮助, Suebphatt
ruby-on-rails - 在统一的画布上高效地渲染许多图像
我迷路了,需要方向。
我们正在尝试使用 imagemagick 将一堆小图像 (X) 渲染到一个统一的画布上。
不同的 X 可以是五种不同尺寸之一:20x20、40x40、60x60、80x80 或 100x100。大图的宽度始终设置为 600,但高度可以根据需要进行调整。
在任何给定时刻,我们可以使用少至 10 个或多至 10,000 个 X。
目前,我们正在使用的基本概念证明类似于:
...它既简单又愚蠢,但它确实输出了一系列合并为一个的图像。差不多好了 ;-)
有谁知道一种有效的算法,我们可以使用它迭代许多 X 并将它们并排放置,跨越多行并仍然优化空间?这里的目标是创建一个没有空白的单一图像,由所有小图像构成。
如前所述,我希望你们对此有任何反馈。指针?想法?例子?
谢谢。
ruby-on-rails - 在 Rails 应用程序中使用 rmagick 时出错
尝试运行 rails 应用程序时出现以下错误:-
/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick2.so:libMagickCore.so.4:无法打开共享对象文件:没有这样的文件或目录 - /opt/ruby-enterprise-1.8 中的 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick2.so (LoadError)。 7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
require' 来自 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1 .0/lib/active_support/dependencies.rb:354:innew_constants_in' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
require' 来自 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick。 rb:11 来自 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:ingem_original_require' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
需要'来自 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:inrequire' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
new_constants_in' 来自 /opt/ruby -enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:inrequire' from /home/amol/Amol_Backup/AMOL_BACKUP_20091021/PROJECTS/Fitsmi/life180/config/environment.rb:12 from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' 来自 /opt/ruby-enterprise-1.8.7- 2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
来自/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0 /lib/active_support/dependencies.rb:354:innew_constants_in' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in
需要'来自 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/webrick.rb:59 来自 /opt/ruby-enterprise -1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' 来自 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ activesupport-2.1.0/lib/active_support/dependencies.rb:509:inrequire' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in
new_constants_in' 来自 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib /active_support/dependencies.rb:509:inrequire' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39 from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' 来自 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in 'require' 来自脚本/服务器:3
文件 RMagick2.so 位于给定路径 /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib 中。
以下是我的应用程序正在使用的版本:-
rails 2.3.5
ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2010.02
rmagick (2.12.2)
imagemagick 6.2.8.0-4.el5-5.3
操作系统:- Centos 5
提前致谢....
ruby - How to convert an image string into a stream in Ruby
I use Ruby Gem curb to fetch image by the method of body_str of Curl::Easy instance, then want to use RMagick to process the image, however Magick::Image.read needs a file name to read, but what i get is the content string of the image. Yes, i know i can firstly convert the image content string into a file, then pass the file name to Magick::Image.read method. But that will add one more IO operation.
So i want to know whether it's possible to convert an image content string into stream directly, so that i can use RMagick to read it directly.
Thank you in advance.
ruby - 给定坐标和颜色,如何以编程方式确定该颜色的连续区域?
我正在使用 Ruby 和 RMagick 来处理图像,但问题与语言无关......
我基本上是在处理表格数据的图像,并认为确定单元格的最简单方法之一是检测一个连续的白色区域(或任何背景颜色),然后获取内容的边界框。
但是在任何给定位置确定颜色的连续区域的最有效方法是什么?
ruby - 使用 Rack 时 RMagick 中的总线错误?
单独运行任何一个都可以,但是当两者一起运行时,它会严重崩溃,看起来像Magick::Image#new
(我第一次调用它)。
编辑:对代码的请求如下:
在 Ramaze 下,问题可以这样重现
然后访问0.0.0.0:7004
将崩溃。