jnicklas/carrierwave — pull request #691 by xtreme-tanzeeb-khalili (2012-04-10 16:01:50+00:00)
Title: Add more sophisticated multi-page PDF support

Hi,

I needed a way to extract the cover of a PDF as a separate version.

Unfortunately, the current multi-page PDF support in the RMagick processor lets you either generate all pages as separate images or one vertically-joined image.

This patch allows you to accept an additional parameter, zero-indexed page number, from the ```manipulate!``` block.

You can then write a custom processor like this:

```ruby
def cover
manipulate! do |frame, index|
frame if index.zero?
end
end
```

Single page PDFs and regular images will receive ```index = 0```, and existing processors can ignore the index parameter. This patch should also work for other multi-frame files, such as animated GIFs.