image_voodoo 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 432be5fdc3ce35d25ccec454aec40066f07f512fdf0d45891ecc49ff28e48368
4
- data.tar.gz: cacc16a2c686344983bab91d9467ff8a80957f22db50ab037f54553bd1004823
3
+ metadata.gz: 3d24878700c42fffc45906b81ad93e9a9a401e37163a1a3681abd43412c63145
4
+ data.tar.gz: 4b6cc8ad69f184f89f59624d932e1f3b7daad8db660565d27086f4186431367d
5
5
  SHA512:
6
- metadata.gz: 421f317327a6d6ecb7c799cd1d4bee0a8a0193ce5f9395c55c2b642387d4fb8b6f62533255b565a5698d379c5ac91d19b0c0fc9fa7776116efee90c537ecf7dd
7
- data.tar.gz: 2fe8bfed88aaa7645ed9eb240a652a0c47c095e72043f62dddfe5effcf415c3d833a2b5f6991ad852bb9a9bd06e4bd3363742807229c7efb0b227ab0b1d123af
6
+ metadata.gz: 4ac6d410f3e4eb47a38ba63a631b2485e8fd6896c900b41c4542771061ca0a57ea1f16c6ca905e4907cdf5dd8aeb0184b2c062463f32173a3127a8763f719b68
7
+ data.tar.gz: 3df78c465bffd57c43b0e11434a1ffd9cd6ffff41be4a216546589085d5bb3d0f1c08570e9a4b6653959b5de516dc3230ae8fd2ca1e2650a7f932301a315f885
data/bin/image_voodoo CHANGED
@@ -42,6 +42,12 @@ opts = OptionParser.new do |o|
42
42
  actions << ->(img) { img.add_border(options) }
43
43
  end
44
44
 
45
+ o.on('-c', '--crop X,Y,WIDTH,HEIGHT', 'Crop the image') do |args|
46
+ x, y, width, height = args.split(/,/).map(&:to_i)
47
+
48
+ actions << ->(img) { img.crop(x, y, width, height) }
49
+ end
50
+
45
51
  o.on('-d', '--dimensions', 'Print the image dimensions') do
46
52
  actions << ->(img) { img.tap { puts "#{img.width}x#{img.height}" } }
47
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ImageVoodoo
4
- VERSION = '0.9.2'
4
+ VERSION = '0.9.3'
5
5
  end
data/lib/image_voodoo.rb CHANGED
@@ -94,6 +94,12 @@ class ImageVoodoo
94
94
  block_given? ? yield(target) : target
95
95
  end
96
96
 
97
+ # crops part of an image
98
+ def crop(x, y, width, height)
99
+ target = with_crop(x, y, x + width, y + height)
100
+ block_given? ? yield(target) : target
101
+ end
102
+
97
103
  # Creates a square thumbnail of the image cropping the longest edge to
98
104
  # match the shortest edge, resizes to size, and yields/returns the new image.
99
105
  def cropped_thumbnail(size)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_voodoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas E. Enebo, Charles Nutter, Nick Sieger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-12 00:00:00.000000000 Z
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -148,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
148
  version: '0'
149
149
  requirements:
150
150
  - jar com.drewnoakes, metadata-extractor, 2.11.0
151
- rubygems_version: 3.2.14
151
+ rubygems_version: 3.2.29
152
152
  signing_key:
153
153
  specification_version: 4
154
154
  summary: Image manipulation in JRuby with ImageScience compatible API