If at all you want to do any kind of prepreocessing on attachments using paperclip then here is a simple(not wen i did it for the first time…) way of getting a TempFile object and doing whatever you want.

Here I set the size of image (actually reduce the original size into half)