Tag: rmagick

使用ImageMagick进行Brew链接

安装: ostaptan:~ostap $ brew install imagemagick –disable-openmp –from-source ==> Downloading http://downloads.sf.net/project/machomebrew/mirror/ImageMagick-6.7.7-6.tar.bz2 Already downloaded: /Library/Caches/Homebrew/imagemagick-6.7.7-6.tar.bz2 ==> Patching patching file configure Hunk #1 succeeded at 32371 (offset 447 lines). ==> ./configure –disable-osx-universal-binary –without-perl –prefix=/usr/local/Cellar/imagemagick/6.7.7-6 –enable-shared –disable-static ==> make install Error: The linking step did not complete successfully The formula built, but is not symlinked into /usr/local You […]

ImageMagick多行文本和背景图像

我正在学习使用ImageMagick,但是当我尝试生成如下例子的图像时遇到了麻烦: 为此,我使用以下代码: convert original.jpg -size 460x caption:’This is a multiline caption, This is a multiline caption, This is a multiline caption.’ result.jpg 此命令生成两个单独的图像,一个只有标题。 你能帮助我吗? PS:我正在使用带有ImageMagick的RubyOnRails,但您可以使用MiniMagick或Rmagick建议示例。 谢谢。

使用透明背景将PDF转换为PNG

我们有一个Ruby on Rails应用程序,需要将PDF转换为具有透明背景的PNG。 我们正在使用rmagick 2.13.1。 在我们的开发机器上,以下代码正是我们想要的。 pages = Magick::Image.from_blob(book.to_pdf.render){ self.density = 300 } page = pages[0] image_file = Tempfile.new([‘preview_image’, ‘.png’]) image_file.binmode image_file.write( page.to_blob { |opt| opt.format = “PNG” } ) 我们保存image_file,所有都是桃子。 但是,当我们部署到Heroku上的评论服务器时,生成的图像具有白色背景。 事实certificate,Heroku的雪松堆正在使用imagemagick ImageMagick 6.5.7-8 2010-12-02,我们在开发机器上使用ImageMagick 6.7.5-7 2012-05-08。 我已经在网上搜索了可能适用于旧版本的旧post,试图找出如何生成透明的PNG。 它肯定得到了支持,但到目前为止,我还没有找到正确的设置组合。 为了validation它不是PDF生成的问题,我下载了一个在Heroku上生成的PDF,并使用上面的代码(略微修改为读取文件而不是生成它)成功转换为透明PNG。 我在各种组合中尝试过的一些事情是: page.matte = true page.format = “PNG32” page.background_color = “none” page.transparent_color = “white” page.transparent(“white”) […]

如何使用CarrierWave生成视网膜(iPad)友好(渐进式或隔行扫描)jpeg图像?

有很多报道称Mobile Safari会对非常大的JPEG图像进行下采样,因此难以为新iPad推出适合视网膜的分辨率。 解决方案似乎是将JPEG编码为渐进/隔行扫描文件。 因此,我很好奇我如何使用CarrierWave插件和RMagick扩展来生成这种类型的文件。 谢谢!

无法安装RMagick 0.0.0。 找不到Magick-config

我正在运行debian服务器并在很长一段时间后升级所有软件包( apt-get update , apt-get upgrade , apt-get distro-upgrade )。 然后rmagick不再工作了因为imagemagick被更新了。 所以我跑了: gem uninstall rmagick bundle install 然后我得到了这个: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/local/bin/ruby extconf.rb checking for Ruby version >= 1.8.5… yes checking for gcc… yes checking for Magick-config… no Can’t install RMagick 0.0.0. Can’t find Magick-config in /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games *** extconf.rb failed […]

突然间开始“无法运行’识别’命令。 请安装ImageMagick。“

我已经让ImageMagick,RMagick和PaperClip正常工作,包括production.rb .rb文件中的配置Paperclip.options[:command_path] 。 突然间,我开始收到以下错误: Could Not Run The `Identify` Command. Please Install ImageMagick. 我已经尝试了一切。 我重新安装了ImageMagick等,但无济于事。 任何帮助将不胜感激。

RMagick + Rails + Heroku?

我正试图找出如何在我的应用程序上获取rmagick,然后让它在Heroku上运行?

Carrierwave RMagick没有删除转换为jpg的透明度

我正在尝试上传PNG并保存一堆缩略图。 缩略图都应该是JPG,没有任何透明度。 不知何故,文件保存为jpg但它具有透明度…… 这是我的上传者: # encoding: utf-8 class WinePhotoUploader ‘jpg’ version :croppable, :if => :new_upload? do process :resize_and_pad => [1200, 1200, ‘white’] end version :show, :if => :new_upload? do process :resize_to_fit => [nil, ‘425’] end version :general, :from_version => :show, :if => :new_upload? do process :resize_and_pad => [150, 375, ‘white’] end version :thumb, :from_version => […]

rmagick有一种方法可以在内存中转换图像

来自Rmagick指南: 将图像转换为另一种格式 将图像转换为另一种格式就像将图像写入文件一样简单。 ImageMagick使用输出文件名suffix (“.jpg” for JPEG, “.gif” for GIF, for example)或prefix (“ps:” for PostScript, for example)以确定输出图像的格式。 有没有办法在内存中转换图像?

在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 / ruby​​gems / 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’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:in来自/opt/ruby-enterprise-1.8.7的’from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/rmagick-2.12.2/lib/RMagick.rb:11 -2010.02 / lib / ruby​​ / site_ruby / 1.8 / ruby​​gems / custom_require.rb:36:in gem_original_require’ from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in gem_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: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: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 […]