Resize existing images to new style in paperclip & RMagick

Solution 1:

You want the reprocess! method of Paperclip::Attachment. See the docs.

class User < ActiveRecord::Base
  has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
end

# Console...
>> User.find_each { |u| u.avatar.reprocess! }

Also, according to the comments before the reprocess! method, there's a paperclip:refresh Rake task, which might be easier.

Solution 2:

try this rake task provided by paperclip

rake paperclip:refresh:missing_styles

Ref: https://github.com/thoughtbot/paperclip#post-processing