workspace-media 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/workspace-media.rb +10 -0
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d431eeac2477d5dd145f0e7fec2b48dd6b165a51
4
- data.tar.gz: caea2925f6ff67112defbbc2525c72c4f08e5337
3
+ metadata.gz: 3eb32e5564e0743e2ffda44a9a77de3bf7232c97
4
+ data.tar.gz: 8cd3f7603140afd8a4369f292d41d4ee5ee98096
5
5
  SHA512:
6
- metadata.gz: 59c141081d1cc47264272853951c0cceb314533453146119e294d4424e0c2be7b710a1377241ca68a33e6def73c1adac8c2d2ecfbacc90a4ecb2f363ecfe2962
7
- data.tar.gz: 8802c73c65012358655d00d479bd0bb2172fb9af0cc23cd59556668bc30d9d49d5822a44d8da3b3fd02bcdfc5afe8f21b0ddedbb1c3aae4ea1a0b9b8982c0e5d
6
+ metadata.gz: ba980d0945c38d6a751d32123cc8153b93801c45c6a549bdda31252ee9726ef9684f00aa1a76b791d40f0550baedec9d0260a30f1035c81c297d751fa824e074
7
+ data.tar.gz: 1098ab4fd884ae0a071a12379acbe458762bdf8c866b3115680099af8618805428d7036b350d5d4276d735e56ae50b92980304e49f228eabc10ee6beedfb44e6
data/workspace-media.rb CHANGED
@@ -45,6 +45,16 @@ module Workspace
45
45
  ensure image&.destroy!
46
46
  end
47
47
 
48
+ def crop(x: 0, y: 0, width: nil, height: nil, quality: 85)
49
+ width = image.columns - x if width.nil?
50
+ height = image.rows - y if height.nil?
51
+ image = Magick::Image.read(to_s).first
52
+ image.crop!(x, y, width, height)
53
+ image.write(to_s) { self.quality = quality }
54
+ self
55
+ ensure image&.destroy!
56
+ end
57
+
48
58
  def optimize!(image_max_width: nil, quality: 85, convert_jpg: true, optimize: true)
49
59
  return false if !exists? or !image?
50
60
  image = Magick::Image.read(to_s).first
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workspace-media
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Strebitzer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-03 00:00:00.000000000 Z
11
+ date: 2018-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workspace