I am using CarrierWave with MiniMagick to resize and uploaded file. I have the version directive in my uploader
version :thumb do
process :resize_to_limit => [100, 100]
end
But when I upload the file, the operation fails. The exception I am getting is
No such file or directory - identify -ping /var/folders/Au/AuBTXIH8HzCAhKdy0jvi+k+++TI/-Tmp-/mini_magick20120906-64039-1gx1ptu.jpg
The name of the file I am uploading is hat.jpg. The /var/folders/Au/AuBTXIH8HzCAhKdy0jvi+k+++TI/-Tmp-/ directory does exist, but when I do the upload I do not see the file in question being created.
Any suggestions as to what the problem may be?
Edit: I have found that the specific issue is that MiniMagick is spawning a command to run identify, and the identify command is not being found. But it is on my system at /usr/local/bin/identify --it was installed as part of ImageMagick.For some reason MiniMagick is not picking it up.
Discovered that the problem was with my RubyMine IDE, not my application or ImageMagick or MiniMagick.
It seems when the RubyMine IDE is launched (by double-clicking the RubyMine icon) it does not inherit the PATH that would exist for a terminal session. Therefore /usr/local/bin/ was not in my server path when I launched the rails server from within RubyMine.
I am able to run my application successfully when launching the server from the command line. I also found that if I launch RubyMine from the command line (using open -a RubyMine), then the terminal session is inherited and everything works as expected.
add to the TOP of your /etc/paths:
/usr/local/bin/
This will tell the mac OS that new shells should have this variable.
I say to add to the top because with homebrew, you are often adding paths that override built in mac applications
Related
I try to upload a product image to my Spree app, but i get this error
5errors prohibited this record from being saved:
Attachment Paperclip returned errors for file 'index.jpg' - check ImageMagick installation or image source file.
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Attachment Paperclip::Errors::NotIdentifiedByImageMagickError
Should i install a gem, relocate my src image? Whats the problem here
You should to install ImageMagick. Follow these steps for install on Windows:
Download ImageMagick (you need to choose static version for your 32/64 bit OS)
Checked Add application directory to your system path and install
Reopen your command prompt to reload your PATH variables
Run convert -v to check the install worked
Okay so the problem is pretty complicated and after trying to solve it for about 3 hours i finally got it.
First, you have to remove the convert.exe from your System32 files.
We do this, because the Spree app relies on legacy code and when it
tries to upload the image the default convert.exe starts, we don't
want that.
Second you download and install the dynamic installation from the imagemagick site and you have to be sure to check the legacy support so the convert command gets supported.
I dont know if you have to, but i installed the paperclip gem. You may have to do that for it to work.
The whole reason this bug happens, is because Windows. So if you are new to this party, dual boot your station or swap to Ubuntu/Mac whatever. Seriously though, when the app tries to upload it uses the convert command, but convert is already a default Windows command so you can't upload the picture properly. So we disable the command and then we replace it with our imagemagick installation. That's it.Also good luck trying to delete the convert.exe from system32, its a weird process, but you can solve it with some google-fu.
Thanks to Michael for pointing me to right way.
I am trying to use RTesseract and mini_magick to do some simple OCR in a Ruby program for some images with white background color and pink font color. Unfortunately, I keep having issues with RTesseract. I have Tesseract-OCR v3.05 installed via the .dll executable found online and stored in my Program Files (x86) folder. I also have ImageMagick v6.9.9 installed via its own executable in Program Files folder (not x86). Here is my code:
require "mini_magick"
require "rtesseract"
RTesseract.configure do |config|
config.processor = "mini_magick"
end
image = MiniMagick::Image.open("input.png")
image = RTesseract.new('input.png').to_s
puts image
As you can see, it is a very simple piece of code. It executes without a problem when I have the RTesseract code commented out, but as soon as I call RTesseract's functionalities, things like the following began to rise up:
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rtesseract-2.1.0/lib/rtesseract.rb:182:in `convert': No such file or directory - tesseract "C:/Users/NORMAL~1/AppData/Local/Temp/20170801-8600-1evxygh.tif" "C:/Users/NORMAL~1/AppData/Local/Temp/1501649603.1925441244" -l eng (RTesseract::ConversionError)
from C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rtesseract-2.1.0/lib/rtesseract.rb:194:in `to_s'
from testingTesseract.rb:12:in `<main>'
I have tried a lot of different things, but nothing seems to get this confounded gem to work. I would've gone to a different language or wrapper by now, but this gem is central to my project and I desperately need a solution.
When I set the environment variable PATH to C:\Program Files (x86)\Tesseract-OCR, tesseract became a recognized command and convert -version started to give the output Invalid Drive Specification. The error now seems to be that ImageMagick is not recognized/found by the calls.
I'm trying to setup ImageMagick so I can use the Paperclip gem for Ruby on Rails. I've looked at pretty much every question on StackOverflow about the issue, but they all just skip over my issue, that none of the ImageMagick commands are recognized on the CommandPrompt.
I downloaded and then installed ImageMagick-7.0.1-1-Q16-x64-dll.exe on this page
I installed the program to my C: directory, so that there wouldn't be an issue with spaces in the Path, and I used all default installation selections and even selected "Install development headers" which some answers said to do. My issue is that when ImageMagick finishes installing, and it says to test some commands (like "convert -version) on Command Prompt, they all result in
"'convert' is not recognized as an internal or external command ...."
On the command prompt. What could be an issue? Every step-by-step tutorial automatically assumes that these commands are recognized. Most troubleshooting involves steps afterwards.
Here's the documentation for paperclip. All I have to do is make sure the gem has access to ImageMagick, by putting in the development.rb file:
Paperclip.options[:command_path] = "/usr/local/bin/"
In order to find that path above, however, the documentation says to type "which convert". I've researched this and apparently that's a Unix command, and not something for Windows.
So basically, what steps do I need to take so that paperclip has access to ImageMagick? Why aren't basic ImageMagick commands recognized, even after a completed installation?
When you install ImageMagick under Windows, they is a button you need to check that tells the script to install "legacy" utilities such as convert. Reinstall, click on this button, and convert is ready to use. Alternatively, install ImageMagick 6.X which deploys convert automatically.
Windows users, I've answered most of this here.
The windows command line won't run which convert. You'll need to use something like git bash.
Reinstalling image magick won't hurt. You could try another file. I know the dll one (you mentioned) is top of the list, the next one is 64bit as well. You must check every option at install as paperclip will use lots of image magick functionality behind the scenes so check all options. Then restart the system.
in command before typing convert you have to type in magick then convert
keep in mind you are using a newer version of IM hence you have to start by typing 'magick' and then follow other command
I set up a app in windows using paperclip and imagemagick and it works fine.
Now, I had to migrate this APP to linux.
I already have paperclip's gem and imagemagick but I can't make it work.
I keep getting this message when saving the image:
sh: identify: command not found
Why? Am I missing something?
Thank you!
ps: I'm able to run the "identify" command from my app's directory.
Within your config/environments/development.rb file (or production if necessary) you can add Paperclips command_path option:
Paperclip.options[:command_path] = '/opt/local/bin'
You will want to replace /opt/local/bin with the directory path returned typing in your command line:
$ which identify
I am getting the following error when uploading an image on the admin panel of spree (RoR e-commerce platform):
Paperclip::NotIdentifiedByImageMagickError in Admin/imagesController#create
/tmp/stream.4724.0 is not recognized by the 'identify' command.
Any ideas? Thanks.
It sounds like the wrong identify command (which is part of ImageMagick) is being called (or, perhaps, it isn't installed at all). Can you confirm the path to this command on your server using:
which identify
Once you've determined where this command is installed (e.g. /usr/local/bin) then you can tell Paperclip about it by adding the following to your environment.rb (or production.rb etc) file:
Paperclip.options[:command_path] = '/usr/local/bin/'
(this is for Paperclip 2.2 and above. If you're using an earlier version you should use :image_magick_path not :command_path)
I solved this problem by
$ sudo apt-get install imagemagick
I'm not saying this is the solution but it wouldn't hurt to check your file permissions. Can the user running imagemagick access files in /tmp/ ?