title: Rails - trying to open a file, but getting MiniMagick::Invalid
body: <p>I am trying load a file in controller, like</p>
  
  <pre><code>  Avatar.all.each do |avatar|
       if avatar.avatar_file_name
         file = "lib/data/#{avatar.avatar_file_name}"
  
         image = MiniMagick::Image.open("#{file}")
         ...
       end
     end 
  </code></pre>
  
  <p>But whenever I run this code, I get the error message</p>
  
  <blockquote>
    <p>MiniMagick::Invalid</p>
  </blockquote>
  
  <p>I already tried to reinstall the <strong>imagemagick</strong> as is mentioned <a href="https://stackoverflow.com/questions/9905499/carrierwave-mini-magick-gems-not-an-image-error">here</a>, but it didn't really help me.</p>
  
  <p>Where could be a problem? Am I missing a component or something?
  Thank you</p>