問題タブ [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 - RMagick/ImageMagick error "no decode delegate for this image format" with Ruby Tempfile
I'm having a problem using RMagick/ImageMagick to open a file uploaded through a Rails form. I believe this is due to the fact that Rails Tempfile behavior is to eliminate the file extension. From what I've read, ImageMagick should prefer to use magic number rather than file extension to detect the image file format, but that doesn't seem to be the case in my installation. I'm doing this:
where full_size_image is the Tempfile object returned from the upload form controller, which creates an error like:
no decode delegate for this image format `/var/folders/uI/uIsldaxoHkiXKWYFuTWs4++++TI/-Tmp-/RackMultipart20101031-10144-1hiwlw-0' @ error/constitute.c/ReadImage/532
This is happening on Mac OS X 10.6 with Rails 2.3.8, RMagick 2.13.1 and ImageMagick 6.6.5-5. I've confirmed that ImageMagick can convert the file I've been using to test through the upload form successfully, and that the tempfile path/file actually exists/is readable.
I suspect that either a) something in my ImageMagick installation is somehow preventing it from using magic number to detect the file type (?? - getting ImageMagick working on Snow Leopard from source was an adventure itself) or b) there are just cases where this doesn't work and I somehow need to make Tempfile preserve the original file extension.
I know that I can get the original file name from the Tempfile object, but I haven't found a way to rename the file. I suppose I could make some kludge where I use a File object and somehow create a copy of the Tempfile with the original extension on it, but that just seems unseemly. What's the right way to solve this problem?
Thanks for your help.
php - ImageMagick の変換と Ruby RMagick への変換を理解する
次の PHP/ImageMagick コードを Ruby RMagick に変換することに失敗しています (将来のユーザーが管理しやすくし、実際に何をしているのかを理解するため):
ここまでで、convert-command が何をしているかはある程度理解できたと思いますが、それを RMagick に翻訳することで、それを再考する必要があります。
例:が のPNG に$output[0] != 1
ある場合 があるのに、RMagickは常にのPNGにあるのはなぜですか? 何か不足していますか?true
$myDir
Image.alpha?
true
$myDir
誰かが convert-command が正確に何をしているのか(式を含む)を説明できれば、私を軌道に戻すための最良の方法だと思います%[fx:u.a]
。
更新: その間、この情報が必要なスクリプトを作成しました。参考になる場合は、Github で確認してください。
imagemagick - 8.04 からのアップグレード後に Ubuntu 10.04 で RMagick が壊れる
最近、サーバーを 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 。それで
アイデアを求めて Web を調べた結果、これを 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 インストールに指定しようとすると、次のいずれかになります。 2 が「gem list」に表示され、2.12.2 のみが Rails アプリによって読み込まれます。(b) 2.13.0 を指定すると、「エラー: どのリポジトリにも有効な gem 'rmagick' (= 2.13.0) が見つかりませんでした」というエラーが表示されます。「gem -v」は1.3.5と言っています。
- -(以降:)
http://wiki.joyent.com/all-accelerators:kb:rubygemsで説明されているように RUbyGems を 1.3.7 に更新しても、何も変わっていません。
macos - MacOSXへのRmagickのインストール中にエラーが発生しました
OSX用のRMagickのインストールに従いました: http ://rmagick.rubyforge.org/install-faq.html#osx
John MadduxからImagemagickのインストールを行いました( MacPortsを使用せずにOSXにImageMagickをインストールするソリューション)
これが私のターミナルウィンドウです:
助けてくれてありがとう、Suebphatt
ruby-on-rails - 統一されたキャンバスに多くの画像を効率的にレンダリングする
私は道に迷っており、方向性が必要です。
imagemagick を使用して、多数の小さな画像 (X) を単一の統合キャンバスにレンダリングしようとしています。
異なる X は、それぞれ 20x20、40x40、60x60、80x80、または 100x100 の 5 つの異なるサイズのいずれかになります。大きな画像の幅は常に 600 に設定されますが、高さは必要に応じて調整できます。
いつでも 10 個から 10,000 個もの X を使用できます。
現在、私たちが取り組んでいるベアボーンの概念実証は、次のようなものです。
...単純でばかげていますが、一連の画像を 1 つにマージして出力します。もうすぐです ;-)
多くの 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:
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' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick. rb:11 from /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
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: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' 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: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' from /opt/ruby-enterprise-1.8.7- 2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31: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' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/webrick.rb:59 from /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' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/ /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib からの 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' /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' から script/server :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 パッチレベル 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 - Rubyで画像文字列をストリームに変換する方法
Ruby Gem curb を使用して Curl::Easy インスタンスの body_str のメソッドで画像を取得し、RMagick を使用して画像を処理したいのですが、Magick::Image.read には読み取るファイル名が必要ですが、得られるのは画像のコンテンツ文字列。はい、最初に画像コンテンツ文字列をファイルに変換し、次にファイル名を Magick::Image.read メソッドに渡すことができることを知っています。ただし、これにより IO 操作がもう 1 つ追加されます。
RMagickを使用して直接読み取ることができるように、画像コンテンツ文字列を直接ストリームに変換できるかどうかを知りたいです。
前もって感謝します。
ruby - 座標と色が与えられた場合、その色の隣接する領域をプログラムで決定するにはどうすればよいですか?
私はRubyとRMagickを使用して画像を処理していますが、問題は言語に依存しません...
私は基本的に表形式のデータの画像を処理しており、セルを決定する最も簡単な方法の1つは、白の連続した領域(または背景色が何であれ)を検出してから、コンテンツの境界ボックスを取得することです。
しかし、特定の場所で色の連続した領域を決定する最も効率的な方法は何ですか?
ruby - Rack使用時のRMagickのバスエラー?
いずれかを単独で実行すると問題なく動作しますが、両方を一緒に実行すると、どうやらMagick::Image#new
(最初に呼び出したとき)、激しくクラッシュします。
編集:以下で満たされるコードのリクエスト:
Ramaze では、この問題を次のように再現できます。
その後、訪問0.0.0.0:7004
するとクラッシュします。