image_vise 0.0.16 → 0.0.17
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/LICENSE.txt +8 -0
- data/README.md +7 -6
- data/image_vise.gemspec +8 -4
- data/lib/image_vise/render_engine.rb +1 -1
- data/lib/image_vise/sRGB_v4_ICC_preference_displayclass.icc +0 -0
- data/lib/image_vise/srgb.rb +30 -0
- data/lib/image_vise.rb +1 -1
- data/spec/image_vise/srgb_spec.rb +28 -0
- data/spec/spec_helper.rb +4 -0
- data/spec/waterside_magic_hour_adobergb.jpg +0 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b6177fda88bf4453fffa272bf1f824865827fb0
|
4
|
+
data.tar.gz: a2c9d53049369496b9dd1ec781bda29ca809397b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 585a4c85b023af887d0e4d508956a864addef958d634baaebf6d84a7639e4d423a16b30f1c59e12e2fd4cb03017118fbb5721af0be7b04a366e6114bc7924fbb
|
7
|
+
data.tar.gz: 049f638ebf0f16a6c8f70df0df0e6ed55392c347e5467ada234b09962f164841f8bfda4741c4e5c767f7b70f2c1a6b0d55de7439783269d3c7140eb9bbdcdde5
|
data/LICENSE.txt
CHANGED
@@ -19,3 +19,11 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
19
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
20
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
21
|
|
22
|
+
To anyone who acknowledges that the file "sRGB_v4_ICC_preference_displayclass" is
|
23
|
+
provided "AS IS" WITH NO EXPRESS OR IMPLIED WARRANTY, permission to use,
|
24
|
+
copy and distribute this file for any purpose is hereby granted without
|
25
|
+
fee, provided that the file is not changed including the ICC copyright
|
26
|
+
notice tag, and that the name of ICC shall not be used in advertising or
|
27
|
+
publicity pertaining to distribution of the software without specific,
|
28
|
+
written prior permission. ICC makes no representations about the
|
29
|
+
suitability of this software for any purpose.
|
data/README.md
CHANGED
@@ -8,8 +8,9 @@ framework. The main uses are:
|
|
8
8
|
|
9
9
|
It is implemented as a Rack application that responds to any URL and accepts the following query string parameters:
|
10
10
|
|
11
|
-
* `q` -
|
12
|
-
|
11
|
+
* `q` - Base64 encoded JSON object with `src_url` and `pipeline` properties
|
12
|
+
(the source URL of the image and processing steps to apply)
|
13
|
+
* `sig` - the HMAC signature, computed over the JSON in `q` before it gets Base64-encoded
|
13
14
|
|
14
15
|
A request to `ImageVise` might look like this:
|
15
16
|
|
@@ -132,7 +133,7 @@ same protocol (a signed JSON-encodded waybill of HTTP(S) source-URL + pipeline i
|
|
132
133
|
|
133
134
|
## Using forked child processes for RMagick tasks
|
134
135
|
|
135
|
-
You can optionally set the `IMAGE_VISE_ENABLE_FORK` environment variable to
|
136
|
+
You can optionally set the `IMAGE_VISE_ENABLE_FORK` environment variable to `yes` to enable forking. When this
|
136
137
|
variable is set, ImageVise will fork a child process and perform the image processing task within that process,
|
137
138
|
killing it afterwards and deallocating all the memory. This can be extremely efficient for dealing with potential
|
138
139
|
memory bloat issues in ImageMagick/RMagick. However, loading images into RMagick may hang in a forked child. This
|
@@ -159,9 +160,6 @@ multiple applications all using different keys for their signatures. Every reque
|
|
159
160
|
each key and if at least one key generates the same signature for the same given parameters, it is going to be
|
160
161
|
accepted and the request will be allowed to go through.
|
161
162
|
|
162
|
-
When running `ImageVise` as a standalone application you can add set the `VISE_SECRET_KEYS` environment
|
163
|
-
variable to a comma-separated list of keys you are willing to accept (no spaces after the commas).
|
164
|
-
|
165
163
|
## Hostname validation
|
166
164
|
|
167
165
|
By default, `ImageVise` will refuse to process images from URLs on "unknown" hosts. To mark a host as "known"
|
@@ -201,3 +199,6 @@ The gem version is specified in `image_vise.rb`. When contributing, please follo
|
|
201
199
|
|
202
200
|
Copyright (c) 2016 WeTransfer. See LICENSE.txt for further details.
|
203
201
|
The licensing terms also apply to the `waterside_magic_hour.jpg` test image.
|
202
|
+
|
203
|
+
The sRGB color profiles are [downloaded from the ICC](http://www.color.org/srgbprofiles.xalter) and it's
|
204
|
+
use is governed by the terms present in the LICENSE.txt
|
data/image_vise.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: image_vise 0.0.
|
5
|
+
# stub: image_vise 0.0.17 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "image_vise"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.17"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Julik Tarkhanov"]
|
14
|
-
s.date = "2016-10-
|
14
|
+
s.date = "2016-10-16"
|
15
15
|
s.description = "Image processing via URLs"
|
16
16
|
s.email = "me@julik.nl"
|
17
17
|
s.extra_rdoc_files = [
|
@@ -35,7 +35,9 @@ Gem::Specification.new do |s|
|
|
35
35
|
"lib/image_vise/image_request.rb",
|
36
36
|
"lib/image_vise/pipeline.rb",
|
37
37
|
"lib/image_vise/render_engine.rb",
|
38
|
+
"lib/image_vise/sRGB_v4_ICC_preference_displayclass.icc",
|
38
39
|
"lib/image_vise/sharpen.rb",
|
40
|
+
"lib/image_vise/srgb.rb",
|
39
41
|
"spec/image_vise/auto_orient_spec.rb",
|
40
42
|
"spec/image_vise/crop_spec.rb",
|
41
43
|
"spec/image_vise/ellipse_stencil_spec.rb",
|
@@ -46,10 +48,12 @@ Gem::Specification.new do |s|
|
|
46
48
|
"spec/image_vise/pipeline_spec.rb",
|
47
49
|
"spec/image_vise/render_engine_spec.rb",
|
48
50
|
"spec/image_vise/sharpen_spec.rb",
|
51
|
+
"spec/image_vise/srgb_spec.rb",
|
49
52
|
"spec/image_vise_spec.rb",
|
50
53
|
"spec/spec_helper.rb",
|
51
54
|
"spec/test_server.rb",
|
52
|
-
"spec/waterside_magic_hour.jpg"
|
55
|
+
"spec/waterside_magic_hour.jpg",
|
56
|
+
"spec/waterside_magic_hour_adobergb.jpg"
|
53
57
|
]
|
54
58
|
s.homepage = "https://github.com/WeTransfer/image_vise"
|
55
59
|
s.licenses = ["MIT"]
|
Binary file
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Applies the sRGB profile to the image.
|
2
|
+
# For this to work, your ImageMagick must be built
|
3
|
+
# witl LCMS support. On OSX, you need to use the brew install
|
4
|
+
# command with the following options:
|
5
|
+
#
|
6
|
+
# $brew install imagemagick --with-little-cms --with-little-cms2
|
7
|
+
#
|
8
|
+
# You can verify if you do have LittleCMS support by checking the
|
9
|
+
# delegates list that `$convert --version` outputs:
|
10
|
+
#
|
11
|
+
# For instance, if you do not have it, the list will look like this:
|
12
|
+
#
|
13
|
+
# $ convert --version
|
14
|
+
# ...
|
15
|
+
# Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
|
16
|
+
#
|
17
|
+
# whereas if you do, the list will include the "lcms" delegate:
|
18
|
+
#
|
19
|
+
# $ convert --version
|
20
|
+
# ...
|
21
|
+
# Delegates (built-in): bzlib freetype jng jpeg lcms ltdl lzma png tiff xml zlib
|
22
|
+
#
|
23
|
+
# The corresponding Pipeline method is `srgb`.
|
24
|
+
class ImageVise::SRGB
|
25
|
+
PROFILE_PATH = File.expand_path(__dir__ + '/sRGB_v4_ICC_preference_displayclass.icc')
|
26
|
+
def apply!(magick_image)
|
27
|
+
magick_image.add_profile(PROFILE_PATH)
|
28
|
+
end
|
29
|
+
ImageVise.add_operator 'srgb', self
|
30
|
+
end
|
data/lib/image_vise.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ImageVise::SRGB do
|
4
|
+
it 'applies the profile, creating a perceptible difference with the original' do
|
5
|
+
opset = ImageVise::Pipeline.new([
|
6
|
+
ImageVise::FitCrop.new(width: 512, height: 512, gravity: 'c'),
|
7
|
+
described_class.new,
|
8
|
+
])
|
9
|
+
|
10
|
+
# This test will function only if you have RMagick with LCMS2 support
|
11
|
+
# built-in. If you do, the two images will look _very_ much like one
|
12
|
+
# another.
|
13
|
+
#
|
14
|
+
# If you don't, the images will look remarkably different
|
15
|
+
# (the AdobeRGB version has color values that match AdobeRGB
|
16
|
+
# primaries, and will render diffrently in pretty much any
|
17
|
+
# viewer).
|
18
|
+
image = Magick::Image.read(test_image_adobergb_path).first
|
19
|
+
opset.apply!(image)
|
20
|
+
image.strip!
|
21
|
+
examine_image(image, "from-adobergb")
|
22
|
+
|
23
|
+
image = Magick::Image.read(test_image_path).first
|
24
|
+
opset.apply!(image)
|
25
|
+
image.strip!
|
26
|
+
examine_image(image, "from-srgb")
|
27
|
+
end
|
28
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -64,6 +64,10 @@ RSpec.configure do | config |
|
|
64
64
|
File.expand_path(__dir__ + '/waterside_magic_hour.jpg')
|
65
65
|
end
|
66
66
|
|
67
|
+
def test_image_adobergb_path
|
68
|
+
File.expand_path(__dir__ + '/waterside_magic_hour_adobergb.jpg')
|
69
|
+
end
|
70
|
+
|
67
71
|
def public_url
|
68
72
|
'http://localhost:9001/waterside_magic_hour.jpg'
|
69
73
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: image_vise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julik Tarkhanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -264,7 +264,9 @@ files:
|
|
264
264
|
- lib/image_vise/image_request.rb
|
265
265
|
- lib/image_vise/pipeline.rb
|
266
266
|
- lib/image_vise/render_engine.rb
|
267
|
+
- lib/image_vise/sRGB_v4_ICC_preference_displayclass.icc
|
267
268
|
- lib/image_vise/sharpen.rb
|
269
|
+
- lib/image_vise/srgb.rb
|
268
270
|
- spec/image_vise/auto_orient_spec.rb
|
269
271
|
- spec/image_vise/crop_spec.rb
|
270
272
|
- spec/image_vise/ellipse_stencil_spec.rb
|
@@ -275,10 +277,12 @@ files:
|
|
275
277
|
- spec/image_vise/pipeline_spec.rb
|
276
278
|
- spec/image_vise/render_engine_spec.rb
|
277
279
|
- spec/image_vise/sharpen_spec.rb
|
280
|
+
- spec/image_vise/srgb_spec.rb
|
278
281
|
- spec/image_vise_spec.rb
|
279
282
|
- spec/spec_helper.rb
|
280
283
|
- spec/test_server.rb
|
281
284
|
- spec/waterside_magic_hour.jpg
|
285
|
+
- spec/waterside_magic_hour_adobergb.jpg
|
282
286
|
homepage: https://github.com/WeTransfer/image_vise
|
283
287
|
licenses:
|
284
288
|
- MIT
|