问题标签 [minimagick]

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.

0 投票
1 回答
3853 浏览

ruby-on-rails - 如何使用carrierwave,mini magick和mongoid验证上传时的图像宽度和高度?

我需要检查人们上传到我网站的图像是否具有 200 像素的确切宽度和 300 像素的高度。如果他们没有这些维度,则不应将它们保存在数据库中。

我已经用 mini-magick 尝试了很长时间,并浏览了许多教程、Stack Overflow 上的帖子等,但我找不到这样做的实用方法。

我在运行 mongoid 的 mongoDB 上使用 ruby​​ 1.9.3 和 rails 3.2.2。

真的希望你能把我引向正确的方向。

我的图像模型如下所示:

我的载波模型如下所示:

0 投票
1 回答
2272 浏览

ruby-on-rails - 在 ruby​​ on rails 3 中使用 minimagick 仅缩放图像宽度

我正在使用这种方法来调整图像的大小:

但是通过这种方法,我可以写出一个固定的高度。

我只想缩放或调整宽度图像。

我希望图像的高度是自动的,并将图像缩放到给定的宽度。

如何缩放或调整大小,只有宽度图像?

我正在使用minimagick 和 carrierwave

0 投票
1 回答
2052 浏览

ruby-on-rails - Resize image using mini_magick, but no file in /tmp directory

I'm using the carrier_wave and mini_magick gems along with ImageMagick in a Rails app. All versions are as current as can be.

It works fine in development mode. However, I just deployed the app and it does not work in production mode.

The problem occurs when I request mini_magick to resize an image:

When I comment out the CarrierWave request to 'resize_to_fit' the image everything works fine.

I've read where mini_magick had some problems with a race condition where the files in the /tmp directory were being deleted by the garbage collector before mini_magick could process them, but those cases seemed to deal with large images and/or cloud storage.

My image file is only 6K and everything is local, so I find it hard to believe that the garbage collector is swooping in and deleting the /tmp file before it can be resized. (But then again, I have no idea of the timing of these things, so I could be wrong.)

Can anyone help me with this?

Thanks, Larry

0 投票
2 回答
8892 浏览

minimagick - 无法使用 mini_magick 裁剪图像

我使用 mini_magick 作为使用 ImageMagick 来操作一些图像的接口。调整大小工作正常。但是当我想裁剪一些图像时:

它不断提示No such file

0 投票
0 回答
844 浏览

ruby - right_aws 和 RMagick/mini_magick:无法从从 s3 抓取的图像中创建图像对象

我正在尝试从 amazon s3 获取图像,用 Rmagick 做一些事情,然后将图像上传回 s3。我正在尝试使用 right_aws 和 RMagick/mini_magick 来做到这一点。到目前为止,我还没有运气。通过使用命令行对其进行测试,Imagemagick 似乎已正确安装。

这是我目前正在尝试做的事情:

使用 right_aws 抓取图像并存储为 RightAws::Key:

然后我试图将 key.data 转换为图像文件。如果我尝试使用以下代码使用 mini_magick

或者

我收到此错误:

如果我尝试使用 RMagick:

或者

我收到此错误:

有人知道我在做什么错吗?我尝试了各种图像,包括 jpg 和 png。我正在使用 rails 3.2.3、ruby 1.9.3p194、ubuntu 11.04、right_aws 3.0.4、rmagick 2.13.1、mini_magick 3.4。

0 投票
3 回答
16718 浏览

ruby-on-rails-3.2 - Carrierwave 错误消息:无法使用 MiniMagick 进行操作,可能不是图像?

我正在将我的应用程序升级到 Ruby 1.9 上的 Rails 3.2。我不得不放弃attachment_fu。Carrierwave 似乎是明显的替代品。在这个阶段,我正在将文件上传到文件系统(还没有云文件)。

我在 Lion,XCode 4.3.2,安装了命令行工具。跑步:

我可以在此配置中上传和调整图像大小:

  • 导轨 3.1.4
  • 红宝石 1.8.7
  • 载波 0.5.8
  • mini_magick 3.4

我可以在新配置中上传图片:

  • 导轨 3.2.3
  • 红宝石 1.9.3(或 1.9.2)
  • 载波 0.6.2

(后跟$ bundle update),但使用调整大小会mini_magick返回此错误消息:

FileUploader 包含:

我的 Attachment 类(带有mount_uploader :file, FileUploader)是 、 和其他附件类的父PortraitReferenceLetter。每个附件类都继承自Attachment、 is:polymorphic => truebelongs_to :attachable(User) ,而后者又继承自has_many :portraits:reference_letters:as => :attachable

这些都不起作用(从carrierwave的已知问题页面链接):

为什么这个 RMagick 调用会产生分段错误?

我不想按照这里的建议手动安装 ImageMagick:

carrierwave + mini_magick gems = 不是图像错误

我正在使用自制软件。帮助会很棒。谢谢。

0 投票
1 回答
1202 浏览

ruby-on-rails - 使用 MiniMagick 将子图像插入另一个图像

我正在寻找使用 MiniMagick 编写 Carrierwave 过程以将子图像添加到另一个图像中,有什么想法吗?

这个文档https://github.com/probablycorey/mini_magick说我们可以使用 ImageMagick 的所有 mogrify 命令行选项,但我不需要复合来做吗?

谢谢你。

0 投票
1 回答
381 浏览

ruby-on-rails - MiniMagick (+Rails):如何显示图像中的场景数量

我有一个 Rails 应用程序可以上传图像以进行图像处理,并且我希望能够 1)查看图像中有多少页/帧/场景,以及 2)将多页图像拆分为单页 jpeg。

我在转换单场景图像的图像类型时没有遇到任何问题,但我不能完全刺穿 ImageMagick 文档来准确理解我要做什么。我正在使用的文档页面在这里:

http://www.imagemagick.org/www/escape.html

在大多数情况下,我希望代码尽可能简单

有没有人比我更清楚该做什么?提前致谢!

0 投票
2 回答
1555 浏览

ruby - 使用 MiniMagick 编写带有标题方法的字符串

我正在尝试在图像上写一个字符串。目前我正在使用 MiniMagick,我可以调整两个图像的大小并重叠,但是当我尝试使用标题编写多行字符串时,最终图像没有任何反应,它仍然和以前一样。

这是我当前的代码:

我的参考资料: http ://www.imagemagick.org/Usage/annotating/

ImageMagick 多行文本和背景图像

http://www.imagemagick.org/www/command-line-options.html#caption

谢谢大家

0 投票
2 回答
1921 浏览

ruby-on-rails - c.draw“文本”中的特殊字符与 mini_magick (rails)

我很难让 mini_magick 在图像上绘制包含引号、双引号等的文本。我尝试了各种修改c.draw无济于事。转义这些字符的最佳方法是什么,以便 c.draw 无错误地显示它们?

错误:non-conforming drawing primitive definitionm'`

由。。。生产

包含其他特殊字符(例如 é)也会导致错误。我希望能够接受来自用户的文本字符串作为输入,因此需要 Unicode 兼容性。