eltiare / carrierwave-vips

CarrierWave image processing powered by VIPS
MIT License
92 stars 39 forks source link

How to specify resizing kernel options #30

Open mlabarca opened 6 years ago

mlabarca commented 6 years ago

Hi there, first of all thank you for all the hard work in this gem. After replacing the standard minimagick resize I'm getting different (By a small but noticeable margin) quality results in jpg resizing, even after removing the sharpening mask. Looking at https://github.com/eltiare/carrierwave-vips/blob/master/lib/carrierwave/vips.rb#L255 it seems resizing images uses either nearest or cubic filter, but ruby vips has more kernel options, with some more coming down the line (See https://github.com/jcupitt/libvips/commit/3b1e3e1841dab816dcf9550bde857423fb57b77f). Is there already a way to pass image resize kernel option and it just needs documenting? Or maybe I should tweak different options to get the quality I used to have with image magick?

Here is the image processed by imagemagick(check the ceiling): imagemagick

Here is the image processed by vips, no sharpening mask: vips

eltiare commented 6 years ago

There are currently no options outside of sharpening for this gem (to my memory). I'm open to either a PR or suggestions. If you're going to do a PR, it's probably best to set it via the configure block.

mlabarca commented 6 years ago

Thanks for the quick reply. That sounds good. Would it make sense to be able to pass on that config block both an 'enlarging' kernel (defaulting in :nearest) and a 'shrinking' kernel (defaulting to :cubic) ?

eltiare commented 6 years ago

Yeah. Try to make it obvious in the name that it's for resizing.

mlabarca commented 6 years ago

@eltiare Here's a pr to add those config options! https://github.com/eltiare/carrierwave-vips/pull/31