carrierwave-vips 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/carrierwave/vips.rb +6 -6
  2. metadata +2 -2
@@ -6,10 +6,10 @@ module CarrierWave
6
6
  SHARPEN_MASK = begin
7
7
  conv_mask = [
8
8
  [ -1, -1, -1 ],
9
- [ -1, 16, -1 ],
9
+ [ -1, 24, -1 ],
10
10
  [ -1, -1, -1 ]
11
11
  ]
12
- ::VIPS::Mask.new conv_mask, 8
12
+ ::VIPS::Mask.new conv_mask, 16
13
13
  end
14
14
 
15
15
  def self.included(base)
@@ -206,6 +206,7 @@ module CarrierWave
206
206
 
207
207
  def resize_image(image, width, height, min_or_max = :min)
208
208
  ratio = get_ratio image, width, height, min_or_max
209
+ return image if ratio == 1
209
210
  if jpeg? # find the shrink ratio for loading
210
211
  shrink_factor = [8, 4, 2, 1].find {|sf| 1.0 / ratio >= sf }
211
212
  shrink_factor = 1 if shrink_factor == nil
@@ -224,17 +225,16 @@ module CarrierWave
224
225
  image = image.tile_cache(image.x_size, 1, 30)
225
226
  ratio = get_ratio image, width, height, min_or_max
226
227
  end
227
- image = image.affinei_resize :bilinear, ratio unless ratio == 1
228
+ image = image.affinei_resize :bicubic, ratio
228
229
  image = image.conv SHARPEN_MASK
229
230
  end
230
231
  image
231
232
  end
232
-
233
+
233
234
  def get_ratio(image, width,height, min_or_max = :min)
234
235
  width_ratio = width.to_f / image.x_size
235
236
  height_ratio = height.to_f / image.y_size
236
- ratio = [width_ratio, height_ratio].send(min_or_max)
237
- ratio
237
+ [width_ratio, height_ratio].send(min_or_max)
238
238
  end
239
239
 
240
240
  def jpeg?(path = current_path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-vips
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-08 00:00:00.000000000 Z
12
+ date: 2012-08-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Adds VIPS support to CarrierWave
15
15
  email: eltiare@github.com