imogen 0.2.2 → 0.3.0

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: 4b23125bf531a9a524f745c2ff9ffed4e3bd2e1aedf26dbdcd07434c0df9bbc0
4
- data.tar.gz: 70b706da9db53e41b691eda24c70b8211cce3073cd99eae77a4045dad7dd0bab
3
+ metadata.gz: '09124ca98f369b44498c5605caa4f45dd5d8225b3416fb2bc4d90e7224a0fda2'
4
+ data.tar.gz: e7e7b386740002d47365e5e1f1838c9328184982bcd90ca081405bf7f615bc6d
5
5
  SHA512:
6
- metadata.gz: fa4d10b1e6aa9a00b72d73daa4796b2ffcd72bde1bfcb8dc36443bfc3f8d82d72a86abff0e1a4f8e6150d17b959c5670bc6868e83a6a40906b40b56fa1e24786
7
- data.tar.gz: f5e43a5c25d37b0b99b0578216169d0cb0deabc5598c46bd21f50cbc546ac38250f3b658609d34751006696c10652399453a2537c12d72e710a515cafa7c5145
6
+ metadata.gz: fddb3b745f8cca9c19e13e58f8d70f520e02a7319f4a46a4191497e47f70f1c5216ce500fe8e95a93b64207a83f1aaa15a889b67a0da507396143fef5aafef4f
7
+ data.tar.gz: 67be3ab83b6823be1b662896085cc896a42c104bd99ea17d0f861dc1f1c1aa538e951fbc6f2aa2f2e13cbcc318d9defc2174bd8abae72d286b24b01261efb82f
@@ -2,7 +2,7 @@ module Imogen
2
2
  module AutoCrop
3
3
  def self.convert(img, dest_path, scale=768, opts = {})
4
4
  Imogen::Iiif::Region::Featured.convert(img, scale, opts) do |smartcrop|
5
- smartcrop.write_to_file(dest_path)
5
+ smartcrop.write_to_file(dest_path, background: [255, 255, 255])
6
6
  end
7
7
  end
8
8
  end
data/lib/imogen/iiif.rb CHANGED
@@ -53,7 +53,7 @@ module Imogen
53
53
  Size.convert(region, opts[:size]) do |size|
54
54
  Rotation.convert(size, opts[:rotation]) do |rotation|
55
55
  Quality.convert(rotation, opts[:quality]) do |quality|
56
- quality.write_to_file(dest_path)
56
+ quality.write_to_file(dest_path, background: [255, 255, 255])
57
57
  yield quality if block_given?
58
58
  end
59
59
  end
@@ -77,4 +77,4 @@ module Imogen
77
77
  }
78
78
  end
79
79
  end
80
- end
80
+ end
data/lib/imogen.rb CHANGED
@@ -10,12 +10,12 @@ module Imogen
10
10
  w = img.width
11
11
  h = img.height
12
12
  dims = (w > h) ? [scale, scale*h/w] : [scale*w/h, scale]
13
- img.thumbnail_image(dims[0], height: dims[1]).write_to_file(dest_path)
13
+ img.thumbnail_image(dims[0], height: dims[1]).write_to_file(dest_path, background: [255, 255, 255])
14
14
  end
15
15
  end
16
16
  module Cropped
17
17
  def self.convert(img, dest_path, edges, scale=nil, format=:jpeg)
18
- img.crop(*edges).write_to_file(dest_path)
18
+ img.crop(*edges).write_to_file(dest_path, background: [255, 255, 255])
19
19
  end
20
20
  end
21
21
  require 'imogen/auto_crop'
@@ -5,6 +5,7 @@ describe Imogen::AutoCrop, vips: true do
5
5
  describe "#convert" do
6
6
  let(:output_file) { Dir.tmpdir + '/test-imogen-crop.jpg' }
7
7
  it "should successfully convert the image" do
8
+ expect_any_instance_of(Vips::Image).to receive(:write_to_file).with(String, {background: [255, 255, 255]}).and_call_original
8
9
  Imogen.with_image(fixture('sample.jpg').path) do |img|
9
10
  Imogen::AutoCrop.convert(img, output_file, 150)
10
11
  end
@@ -5,6 +5,7 @@ describe Imogen::AutoCrop, vips: true do
5
5
  describe "#convert" do
6
6
  let(:output_file) { Dir.tmpdir + '/test-imogen-convert.jpg' }
7
7
  it "should successfully convert the image" do
8
+ expect_any_instance_of(Vips::Image).to receive(:write_to_file).with(String, {background: [255, 255, 255]}).and_call_original
8
9
  Imogen.with_image(fixture('sample.jpg').path) do |img|
9
10
  Imogen::Iiif.convert(img, output_file, 'jpg', region: '50,60,500,800', size: '!100,100', quality: 'color', rotation: '!90')
10
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imogen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Armintor
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-05-09 00:00:00.000000000 Z
12
+ date: 2022-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ruby-vips
@@ -96,7 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
96
  - !ruby/object:Gem::Version
97
97
  version: '0'
98
98
  requirements: []
99
- rubygems_version: 3.2.32
99
+ rubygems_version: 3.1.6
100
100
  signing_key:
101
101
  specification_version: 4
102
102
  summary: IIIF image derivative generation helpers for Vips