I’m building a Rails application where a user can upload an image which is automatically cropped to a certain size, then they can choose an overlay which is exactly the same size as the cropped image.
What I want to do is composite or flatten the two images and save it as a single image – I’ve looked at the Image Magick documentation, but I can’t see how to apply the example they give:
composite -gravity center smile.gif rose: rose-over.png
to work with Paperclip.
Also, the example references two specific images, but I’m wondering how I can pass in a variable (the user uploaded image) instead?
I believe you want to use a paperclip processor.
Here is the high level description:
https://github.com/thoughtbot/paperclip#custom-attachment-processors
Here is a gist example of using composite (recommended here https://github.com/thoughtbot/paperclip/issues/978):
https://gist.github.com/708077