easyimg_utils 0.1.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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data/lib/easyimg_utils.rb +76 -0
- data.tar.gz.sig +0 -0
- metadata +110 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3cee759aabb99c51699ea263edad80ab0cb123eefefa91c564c7c79ec9f17793
|
4
|
+
data.tar.gz: 73490ab571f1b45a411a7c8029dcae48a195769d0e162b4927855c9553ae2ac2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: df63a9adb7f6461c2dd825569b48401fc843af63f2ae498003917fb62cb2eb108dbde2a3814c74a66317f0799e3f97c4af96acea061885292acbc102a453abc5
|
7
|
+
data.tar.gz: 87d8504dcefebf572ccaf18aadb0718d996ba125f730cbc1804b5e4ed9597c6fd18f8b8991451a91572334c4f7c17beac06a9d1d19e9b67415a372cfd95cf4d4
|
checksums.yaml.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: easyimg_utils.rb
|
4
|
+
|
5
|
+
require 'c32'
|
6
|
+
require 'rmagick'
|
7
|
+
|
8
|
+
# requirements:
|
9
|
+
# `apt-get install imagemagick imagemagick-doc libmagickcore-dev libmagickwand-dev`
|
10
|
+
|
11
|
+
|
12
|
+
module CommandHelper
|
13
|
+
using ColouredText
|
14
|
+
|
15
|
+
def list(a=@commands)
|
16
|
+
|
17
|
+
format_command = ->(s) do
|
18
|
+
command, desc = s.split(/\s+#\s+/,2)
|
19
|
+
" %s %s %s" % ['*'.blue, command, desc.to_s.light_black]
|
20
|
+
end
|
21
|
+
|
22
|
+
s = a.map {|x| format_command.call(x) }.join("\n")
|
23
|
+
puts s
|
24
|
+
end
|
25
|
+
|
26
|
+
def search(s)
|
27
|
+
list @commands.grep Regexp.new(s)
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
class EasyImgUtils
|
34
|
+
extend CommandHelper
|
35
|
+
include Magick
|
36
|
+
|
37
|
+
@commands = "
|
38
|
+
* resize # set the maximum geomertry of the image for resizing e.g. '320x240'
|
39
|
+
".strip.lines.map {|x| x[/(?<=\* ).*/]}.sort
|
40
|
+
|
41
|
+
|
42
|
+
def initialize(img_in=nil, img_out='image.jpg', out: img_out,
|
43
|
+
working_dir: '/tmp')
|
44
|
+
|
45
|
+
@file_in, @file_out, @working_dir = img_in, out, working_dir
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
# defines the maximum size of an image while maintaining aspect ratio
|
50
|
+
#
|
51
|
+
def resize(geometry='320x240')
|
52
|
+
|
53
|
+
preview = Magick::Image.read(@file_in).first
|
54
|
+
preview.change_geometry!(geometry) { |cols, rows, img|
|
55
|
+
img.resize!(cols, rows)
|
56
|
+
}
|
57
|
+
preview.write @file_out
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def run(command, show: false)
|
65
|
+
|
66
|
+
if show then
|
67
|
+
command
|
68
|
+
else
|
69
|
+
puts "Using ->" + command
|
70
|
+
system command
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: easyimg_utils
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIEXjCCAsagAwIBA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
|
28
|
+
BgkqhkiG9w0BAQsFAAOCAYEANTImQJnRvlqQBDXU1ok4iqW2TFRQMTixEP/zCXDd
|
29
|
+
IyUz2nwaKvyiTvIVyXpdTWg2UatEvHwaJrFW0Hpghu2f7rYuRvwKpSrPFelEVYJf
|
30
|
+
wyjtqZIiZfQePXjAc9rdmXzbDY7zTHQedMUcaIFocntclpefGGyFg1m7IKXlcrAK
|
31
|
+
BEAaygcKB1S6NhHGm4TfRmdEqPN1sY3COMWjv49rkmQBDcz4KIDxHUa33vHieFq5
|
32
|
+
F+hKSRa1747fYLZc42bpTQBvHR2ZuXRGCY1iNCipXoncu7ZY6wPYvO2HTGDGK9Uk
|
33
|
+
ByawN6V7m2htGNb+q3zLFgLFP91/+60zBdLc7DfYNEiHXajhJsLKWpcSosC3AUaa
|
34
|
+
4IpXr6ATiPj+a8ktF/jAwrpUTFr3qpGa0qW/XVD3o35biL2+3gs6hTqPo3IQYusR
|
35
|
+
6PB/a3YCkvA1ipebq/pmmvF9VopoG5giimE7Rkw0QPUi/w6724YH6tVQj077N2mP
|
36
|
+
WOpXPMFUK6eXTvN8BbxLtUkt
|
37
|
+
-----END CERTIFICATE-----
|
38
|
+
date: 2019-05-05 00:00:00.000000000 Z
|
39
|
+
dependencies:
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: c32
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.2.0
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.2'
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.2.0
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.2'
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: rmagick
|
62
|
+
requirement: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 3.1.0
|
67
|
+
- - "~>"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.1'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 3.1.0
|
77
|
+
- - "~>"
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '3.1'
|
80
|
+
description:
|
81
|
+
email: james@jamesrobertson.eu
|
82
|
+
executables: []
|
83
|
+
extensions: []
|
84
|
+
extra_rdoc_files: []
|
85
|
+
files:
|
86
|
+
- lib/easyimg_utils.rb
|
87
|
+
homepage: https://github.com/jrobertson/easyimg_utils
|
88
|
+
licenses:
|
89
|
+
- MIT
|
90
|
+
metadata: {}
|
91
|
+
post_install_message:
|
92
|
+
rdoc_options: []
|
93
|
+
require_paths:
|
94
|
+
- lib
|
95
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
requirements: []
|
106
|
+
rubygems_version: 3.0.1
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: easyimg_utils
|
110
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|