foggy-mirror 1.0.0 → 1.0.1

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: 1cc9dc0f12ce500219fb0488fb7b8e54c24819a611645a0072a56695ced1336a
4
- data.tar.gz: 883c91418982a115fd45411d80159260c78bb0798078ee6b7a0efa1f85934c63
3
+ metadata.gz: fd9dc0797613dd9564889a8ee92f972656d40a631bc8218f21b92ddda1d9745c
4
+ data.tar.gz: 7209f57bce3182e42a806c5049f2a78903e184ba72e076440275a2ff96ab95b9
5
5
  SHA512:
6
- metadata.gz: 01bcab41ac44cc5305863dc22486cea86cccf94558f1d397942d1a214fbf2ad6fcc6e420312e2cacc9efe4b07064b349fc43769c42ad51aca4623e361d647dd4
7
- data.tar.gz: 788d0af0500e35d613a9108ba04f0b22da5dc33d9ea3cebb69cea1fdeda7e226a57766be6623ae48eff088dc4349c225bdc639a6c9f49257fbfcb76ed4291ab1
6
+ metadata.gz: ff5ff9df6a022ba4eef370d28b6316422328cd67c160104fe479d65a5087dea6b6c46341216b1e67bbd8c6e46c3e5d7bc6251fe1d26d703b1c735d0f9077b9b3
7
+ data.tar.gz: 5db7ce87395d0846861a63b46c2ebb8639922b7cc6ea7808f0fc2dbb5fe37308f7fed281f513bf721a5702e5f1cb8613e29c89c69be55819b37c62f2099587bc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- foggy-mirror (1.0.0)
4
+ foggy-mirror (1.0.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # foggy-mirror
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/foggy-mirror.svg?style=flat)](https://rubygems.org/gems/foggy-mirror)
3
4
  ![CI](https://github.com/beezwax/foggy-mirror/workflows/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LjYgNzcuOTI0OCA5NS42IDc3LjkyNDhWMjkuMzI0OEM5NS42IDI2LjEyNDggOTMgMjQuNjI0OCA5MyAyNC42MjQ4TDcyLjUgMTMuMjI0OEw1MC42IDAuNjI0ODQ1QzQ4LjEgLTAuNjc1MTU1IDQ1LjUgMC40MjQ4NDUgNDUuMyAwLjYyNDg0NUwyMy4xIDEzLjMyNDhIMjIuOVoiIGZpbGw9IiNGRkQ5MzkiPjwvcGF0aD4NCiAgICAgIDxwYXRoIGQ9Ik0wLjEgMzEuNTI0NFY3OC4yMjQ0QzAuMSA4MC44MjQ0IDIuMiA4Mi4zMjQ0IDIuNyA4Mi43MjQ0TDE0LjggODkuNjI0NEwxNy44IDkxLjMyNDRDMjQuNCA4NC43MjQ0IDI4LjQgNzYuMzI0NCAyOC41IDY3LjEyNDRDMjguNSA1MS41MjQ0IDE2LjggMzguMDI0NCAwIDMxLjUyNDRIMC4xWiIgZmlsbD0iI0ZGRDkzOSI+PC9wYXRoPg0KICAgPC9nPg0KPC9zdmc+)](https://beezwax.net/)
4
6
 
5
7
  foggy-mirror is a small Ruby tool that creates faux blurry versions of raster
6
8
  images using radial gradients, exported as either SVG or CSS (using
@@ -15,6 +17,8 @@ very low file size (e.g. the example SVG below is only 814 bytes after gzip).
15
17
  If you need a less blurry version of the original picture, then a regular blur
16
18
  effect saved to JPEG/WebP may be a better value proposition.
17
19
 
20
+ Need Ruby/Rails consulting? Contact us at [Beezwax.net](https://beezwax.net/)
21
+
18
22
  ## Example
19
23
 
20
24
  Original raster image:
@@ -35,7 +39,7 @@ gem 'foggy-mirror'
35
39
 
36
40
  ## Usage
37
41
 
38
- Within Ruby:
42
+ ### Within Ruby
39
43
 
40
44
  ```ruby
41
45
  require 'foggy-mirror'
@@ -75,3 +79,38 @@ Options are:
75
79
  Supported adapters are `FoggyMirror::ImageMagick` (uses CLI commands) and
76
80
  `FoggyMirror::Vips` (fastest, but requires installing `ruby-vips` gem).
77
81
  * `adapter_options` (Hash): options to pass to the adapter on initialization.
82
+
83
+ ### From CLI
84
+
85
+ Command syntax:
86
+
87
+ ```
88
+ $ foggy-mirror [options] [--] image_file ...
89
+ ```
90
+
91
+ For a full list of options use `-h`:
92
+
93
+ ```
94
+ $ foggy-mirror -h
95
+ Usage: foggy-mirror [options] [--] image_file ...
96
+ --res=RESOLUTION The output resolution (how many radial gradients per dimension)
97
+ --overlap=OVERLAP How much to overlap radial gradients
98
+ --dist=DISTRIBUTION Distribution strategy for radial gradients
99
+ --random-offset=OFFSET Upper limit for how much to randomly offset each radial gradient
100
+ --random-seed=SEED The random seed to use (for deterministic results)
101
+ --adapter=ADAPTER Which graphics library adapter to use
102
+ --extension=EXTENSION The extension to use for created files (default: .foggy.svg)
103
+ --stdout Output to STDOUT instead of writing to files
104
+ --target-dir=DIR Directory to write files to (defaults to same as input files)
105
+ -h, --help Print help
106
+ --version Show version
107
+ ```
108
+
109
+ Simple example:
110
+
111
+ ```
112
+ $ foggy-mirror some_image.jpg some_other_image.webp yet_another_one.gif
113
+ ```
114
+
115
+ The above will create files `some_image.foggy.svg`,
116
+ `some_other_image.foggy.svg` and `yet_another_one.foggy.svg`.
@@ -38,7 +38,7 @@ module FoggyMirror
38
38
  OptionParser.new do |opts|
39
39
  opts.banner = 'Usage: foggy-mirror [options] [--] image_file ...'
40
40
 
41
- opts.on('--res=RESOLUTION', Integer, 'The output resolution (how many radial gradients per dimension)') do |r|
41
+ opts.on('--res=RESOLUTION', Integer, "The output resolution (how many radial gradients per dimension, default: #{DEFAULT_RESOLUTION})") do |r|
42
42
  @options[:resolution] = r
43
43
  end
44
44
 
@@ -20,8 +20,8 @@ module FoggyMirror
20
20
  @base_color ||= adapter.dominant_color
21
21
  end
22
22
 
23
- def color_samples(res)
24
- @color_samples ||= adapter.color_samples(res)
23
+ def color_samples
24
+ @color_samples ||= adapter.color_samples(resolution)
25
25
  end
26
26
 
27
27
  def to_css(hash: false)
@@ -33,7 +33,7 @@ module FoggyMirror
33
33
  end
34
34
 
35
35
  def blobs
36
- samples = color_samples(resolution)
36
+ samples = color_samples
37
37
 
38
38
  increment = 1.0 / (resolution - 1)
39
39
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FoggyMirror
4
- VERSION = "1.0.0"
4
+ VERSION = "1.0.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foggy-mirror
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pedro Carbajal