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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +40 -1
- data/lib/foggy-mirror/cli.rb +1 -1
- data/lib/foggy-mirror/processor.rb +3 -3
- data/lib/foggy-mirror/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd9dc0797613dd9564889a8ee92f972656d40a631bc8218f21b92ddda1d9745c
|
4
|
+
data.tar.gz: 7209f57bce3182e42a806c5049f2a78903e184ba72e076440275a2ff96ab95b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff5ff9df6a022ba4eef370d28b6316422328cd67c160104fe479d65a5087dea6b6c46341216b1e67bbd8c6e46c3e5d7bc6251fe1d26d703b1c735d0f9077b9b3
|
7
|
+
data.tar.gz: 5db7ce87395d0846861a63b46c2ebb8639922b7cc6ea7808f0fc2dbb5fe37308f7fed281f513bf721a5702e5f1cb8613e29c89c69be55819b37c62f2099587bc
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# foggy-mirror
|
2
2
|
|
3
|
+
[](https://rubygems.org/gems/foggy-mirror)
|
3
4
|

|
5
|
+
[](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`.
|
data/lib/foggy-mirror/cli.rb
CHANGED
@@ -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,
|
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
|
24
|
-
@color_samples ||= adapter.color_samples(
|
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
|
36
|
+
samples = color_samples
|
37
37
|
|
38
38
|
increment = 1.0 / (resolution - 1)
|
39
39
|
|
data/lib/foggy-mirror/version.rb
CHANGED