pixel_dreamer 0.1.1 → 0.1.2
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/README.md +155 -9
- data/lib/pixel_dreamer/constants.rb +43 -43
- data/lib/pixel_dreamer/version.rb +1 -1
- data/lib/pixel_dreamer.rb +66 -19
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2755662834b6d29d86003e61a56ad76ef757c0e
|
4
|
+
data.tar.gz: 574338b44d0b554334fdc46548edcfd28b3fbd09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9007beee381eff013770d34073473b0bee89d98c34ca746d547d13ce9580503bbe51a6907727ddbafca0f5fe73913285960bf32ec955be390204c834ee4ecd1
|
7
|
+
data.tar.gz: 096333590019121c53569b48d20df0c1f636f62d019b7b286d2f2aa9bc0e4f689c96ed1d5b3ce2944670d31f0d6f71107eb5f1e18c9fc30f80b002dc74335d9b
|
data/README.md
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
# PixelDreamer
|
2
2
|
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/pixel_dreamer`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
3
|
## Installation
|
8
4
|
|
9
5
|
Add this line to your application's Gemfile:
|
10
6
|
|
7
|
+
Install RMagick and ImageMagick from here: [RMagick](https://github.com/rmagick/rmagick)
|
8
|
+
|
11
9
|
```ruby
|
12
10
|
gem 'pixel_dreamer'
|
13
11
|
```
|
@@ -22,17 +20,165 @@ Or install it yourself as:
|
|
22
20
|
|
23
21
|
## Usage
|
24
22
|
|
25
|
-
|
23
|
+
### ImageDreamer
|
24
|
+
|
25
|
+
To use pixel dreamer you must first create a new `PixelDreamer::ImageDreamer` class
|
26
|
+
to do this you must pass in the uri of the image you will be pixel sorting:
|
27
|
+
```ruby
|
28
|
+
image = PixelDreamer::ImageDreamer.new('/uri/image.png')
|
29
|
+
```
|
30
|
+
|
31
|
+
you can also pass in an image to be laid on top of the image that is pixel sorted,
|
32
|
+
overlay image is optional:
|
33
|
+
|
34
|
+
|
35
|
+
```ruby
|
36
|
+
image = PixelDreamer::ImageDreamer.new('/uri/image.png', 'overlay/image.png')
|
37
|
+
```
|
38
|
+
#### brute_sort_save_with_settings
|
39
|
+
|
40
|
+
pixel sorts an image and outputs a text file with settings used.
|
41
|
+
once the image has been instantiated you can run this method without passing in any parameters.
|
42
|
+
by default it runs with these paramaters:
|
43
|
+
`{ settings: DEFAULTS, output_name: nil, gif: false, output_folder: false }`
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
image.brute_sort_save_with_settings
|
47
|
+
```
|
48
|
+
|
49
|
+
or with these parameters
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
image.brute_sort_save_with_settings(settings: PixelDreamer::Constants::DEFAULTS, output_name: nil,
|
53
|
+
gif: false, output_folder: false)
|
54
|
+
```
|
55
|
+
|
56
|
+
or
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
image.brute_sort_save_with_settings(settings: { reverse: false, vertical: false, diagonal: false,
|
60
|
+
smooth: false, method: 'sum-rgb', verbose: false,
|
61
|
+
min: Float::INFINITY, max: Float::INFINITY,
|
62
|
+
trusted: false, middle: false })
|
63
|
+
```
|
64
|
+
|
65
|
+
also read the documentation for [pxlsrt](https://github.com/czycha/pxlsrt) to get an idea of what these parameters do
|
66
|
+
|
67
|
+
|
68
|
+
#### glitch_sequence
|
69
|
+
|
70
|
+
|
71
|
+
creates a sequence of pixel sorted images based on the setting hash and a sequence_setting hash chosen.
|
72
|
+
once the image has been instantiated you can run this method without passing in any parameters
|
73
|
+
by default it is executed with these settings:
|
74
|
+
|
75
|
+
`settings: SETTINGS[:soft], sequence_settings: SEQUENCE_SETTINGS[:high_short], compress: true, speed: 84 `
|
76
|
+
|
77
|
+
example:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
image.glitch_sequence
|
81
|
+
```
|
82
|
+
|
83
|
+
or with parameters, an output name can be passed in as well (string)
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
image.glitch_sequence({ settings: PixelDreamer::Constants::SETTINGS[:sharp],
|
87
|
+
sequence_settings: PixelDreamer::Constants::SEQUENCE_SETTINGS[:high_long],
|
88
|
+
compress: false, speed: 42, output_name: 'image_glitched' })
|
89
|
+
```
|
90
|
+
|
91
|
+
the output name must only include the name of the output image not the file extension.
|
92
|
+
this creates a sequence of of images that have been pixel sorted with the increments specified.
|
93
|
+
the settings_hash can be pulled from the `SETTINGS` constant, defaults to `SETTINGS[:soft]`.
|
94
|
+
the sequence_settings can be pulled from the `SEQUENCE_SETTINGS` constant, defaults to `SEQUENCE_SETTINGS[:high_short]`.
|
95
|
+
compress defaults to true, copies and compresses input file and creates sequence from compressed file
|
96
|
+
the fps is set by the speed which is in milliseconds, defaults to 84ms (12fps)
|
97
|
+
the uri_helper method can be used to create the input uri
|
98
|
+
|
99
|
+
#### barrage
|
100
|
+
|
101
|
+
creates an image for each setting from the settings hash. quickest way to see how all of the settings effect the image supplied.
|
102
|
+
once the image has been instantiated you can run this method without passing in any parameters
|
103
|
+
by default it is executed with these settings:
|
104
|
+
`gif: false, compress: true, speed: 84`
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
image.barrage
|
108
|
+
```
|
109
|
+
|
110
|
+
or with parameters, an output name (string) can be passed in as well
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
image.barrage({ gif: true, compress: false, speed: 42, output_name: 'image_glitched' })
|
114
|
+
```
|
115
|
+
|
116
|
+
the output name must only include the name of the output image not the file extension
|
117
|
+
the uri_helper can be used to create the input uri
|
118
|
+
|
119
|
+
#### randomize
|
120
|
+
|
121
|
+
creates a series of images that are pixel sorted with randomized settings, the output is very hectic.
|
122
|
+
once the image has been instantiated you can run this method without passing in any parameters
|
123
|
+
by default it is executed with these settings:
|
124
|
+
`gif: false, compress: true, speed: 84, image_number: 10`
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
image.randomize
|
128
|
+
```
|
129
|
+
|
130
|
+
or with parameters, an output name (string) can be passed in as well
|
131
|
+
|
132
|
+
```ruby
|
133
|
+
image.randomize({ gif: trues, compress: false, speed: 42, image_number: 20, output_name: 'image_glitched' })
|
134
|
+
```
|
26
135
|
|
27
|
-
|
136
|
+
the output name must only include the name of the output image not the file extension
|
137
|
+
the amount of images that are created are based on the image_number (integer)
|
28
138
|
|
29
|
-
|
139
|
+
#### gif
|
30
140
|
|
31
|
-
|
141
|
+
creates a gif using the images created from using either the randomize, glitch_sequence or barrage methods.
|
142
|
+
once the image has been instantiated you can run this method without passing in any parameters
|
143
|
+
by default it is executed with these settings:
|
144
|
+
`speed: 84, dither: DITHER_DEFAULTS, image_delay: IMAGE_DELAY_DEFAULTS`
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
image.gif
|
148
|
+
```
|
149
|
+
|
150
|
+
or with parameters, an output name (string) can be passed in as well
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
image.gif({speed: 42, dither: PixelDreamer::Constants::DITHER_DEFAULTS,
|
154
|
+
image_delay: PixelDreamer::Constants::IMAGE_DELAY_DEFAULTS, output_name: 'image_gif'})
|
155
|
+
```
|
156
|
+
or
|
157
|
+
|
158
|
+
```ruby
|
159
|
+
image.gif({speed: 42, dither: {active: false, number_of_colors: 200},
|
160
|
+
image_delay: {active: false, image_to_delay: 1, delay_length: 1000}, output_name: 'image_gif'})
|
161
|
+
```
|
162
|
+
|
163
|
+
speed is used to set the length of time for each frame of the gif, it defaults to milliseconds
|
164
|
+
- 12 fps: length of frame = 84 ms
|
165
|
+
- 24 fps: length of frame = 42 ms
|
166
|
+
- 30 fps: length of frame = 33 ms
|
167
|
+
- 60 fps: length of frame = 17 ms
|
168
|
+
the dither hash used to set the dither settings
|
169
|
+
the image_delay hash is used to pause the sequence on an image for a set amount of time
|
170
|
+
|
171
|
+
#### uri_helper
|
172
|
+
|
173
|
+
creates a uri by adding the name to common paths
|
174
|
+
|
175
|
+
```ruby
|
176
|
+
test = uri_helper('desktop', 'test.png')
|
177
|
+
```
|
32
178
|
|
33
179
|
## Contributing
|
34
180
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
181
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/13um45/pixel_dreamer.
|
36
182
|
|
37
183
|
|
38
184
|
## License
|
@@ -1,58 +1,58 @@
|
|
1
1
|
module PixelDreamer
|
2
2
|
module Constants
|
3
|
-
SETTINGS = {sharp: {
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
3
|
+
SETTINGS = { sharp: { vertical: true, min: 20, max: 60, method: 'uniqueness' },
|
4
|
+
soft: { vertical: true, min: 100, max: 300 },
|
5
|
+
soft_diagonal: { diagonal: true, min: 100, max: 300 },
|
6
|
+
side_glitch: { vertical: false, min: 40, middle: -1 },
|
7
|
+
side_glitch_soft: { vertical: false, min: 100, max: 300, middle: -1 },
|
8
|
+
side_glitch_erratic: { vertical: false, min: 100, max: 300, middle: -4 },
|
9
|
+
vertical_glitch_soft: { vertical: true, min: 100, max: 300, middle: -1 },
|
10
|
+
soft_unique: { vertical: true, min: 100, max: 300, method: 'uniqueness' },
|
11
|
+
side_soft_unique: { vertical: false, min: 100, max: 300, method: 'uniqueness' },
|
12
|
+
side_soft_aggressive: { vertical: false, min: 100, max: 300, method: 'sum-hsb', smooth: true },
|
13
|
+
side_soft_harsh: { vertical: false, min: 100, max: 300, method: 'hue', smooth: true },
|
14
|
+
side_soft_sand: { vertical: false, min: 100, max: 300, method: 'random', smooth: true },
|
15
|
+
side_soft_yellow: { vertical: false, min: 100, max: 300, method: 'yellow', smooth: true },
|
16
|
+
soft_reverse: { vertical: true, min: 100, max: 300, reverse: true },
|
17
|
+
soft_min: { diagonal: true, max: 6 },
|
18
|
+
cinna: { vertical: true, min: 150, max: 300 },
|
19
|
+
cami: { vertical: true, min: 60, max: 120 } }.freeze
|
20
20
|
|
21
21
|
SORTING_METHODS = ['sum-rgb', 'red', 'green', 'blue', 'sum-hsb', 'hue', 'saturation', 'brightness', 'uniqueness',
|
22
|
-
'luma', 'random', 'magenta', 'cyan', 'yellow', 'alpha', 'sum-rgba', 'sum-hsba', 'none']
|
22
|
+
'luma', 'random', 'magenta', 'cyan', 'yellow', 'alpha', 'sum-rgba', 'sum-hsba', 'none'].freeze
|
23
23
|
|
24
|
-
RANDOMIZE_SETTINGS = {reverse: [true, false], vertical: [true, false], diagonal: [true, false],
|
25
|
-
|
26
|
-
|
24
|
+
RANDOMIZE_SETTINGS = { reverse: [true, false], vertical: [true, false], diagonal: [true, false],
|
25
|
+
smooth: [true, false], method: SORTING_METHODS, min: (1..1000).to_a,
|
26
|
+
max: (1..1000).to_a, trusted: [true, false], middle: [true, false], verbose: [true] }.freeze
|
27
27
|
|
28
|
-
RANDOMIZE_DEFAULTS = {gif: false, compress: true, speed: 84, image_number: 10}
|
28
|
+
RANDOMIZE_DEFAULTS = { gif: false, compress: true, speed: 84, image_number: 10 }.freeze
|
29
29
|
|
30
|
-
SEQUENCE_SETTINGS = {high_long: {counter: 1, max_multiple: 3, increment: 1, break_point: 101},
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
30
|
+
SEQUENCE_SETTINGS = { high_long: { counter: 1, max_multiple: 3, increment: 1, break_point: 101 },
|
31
|
+
high_short: { counter: 1, max_multiple: 3, increment: 1, break_point: 31 },
|
32
|
+
high_short_late: { counter: 70, max_multiple: 3, increment: 1, break_point: 101 },
|
33
|
+
cinna: { counter: 120, max_multiple: 2, increment: 1, break_point: 151 },
|
34
|
+
cami: { counter: 60, max_multiple: 2, increment: 1, break_point: 91 },
|
35
|
+
high_short_late_middle: { counter: 45, max_multiple: 3, increment: 1, break_point: 76 },
|
36
|
+
high_short_early: { counter: 20, max_multiple: 3, increment: 1, break_point: 51 },
|
37
|
+
low_short: { counter: 1, max_multiple: 3, increment: 3, break_point: 31 },
|
38
|
+
low_long: { counter: 1, max_multiple: 3, increment: 3, break_point: 101 } }.freeze
|
39
39
|
|
40
|
-
DEFAULTS = {reverse: false, vertical: false, diagonal: false,
|
41
|
-
|
42
|
-
|
43
|
-
|
40
|
+
DEFAULTS = { reverse: false, vertical: false, diagonal: false,
|
41
|
+
smooth: false, method: 'sum-rgb', verbose: false,
|
42
|
+
min: Float::INFINITY, max: Float::INFINITY,
|
43
|
+
trusted: false, middle: false }.freeze
|
44
44
|
|
45
|
-
GLITCH_SEQUENCE_DEFAULTS = {settings: SETTINGS[:soft], sequence_settings: SEQUENCE_SETTINGS[:high_short],
|
46
|
-
|
45
|
+
GLITCH_SEQUENCE_DEFAULTS = { settings: SETTINGS[:soft], sequence_settings: SEQUENCE_SETTINGS[:high_short],
|
46
|
+
compress: true, speed: 84, gif: true }.freeze
|
47
47
|
|
48
|
-
BARRAGE_DEFAULTS = {gif: false, compress: true, speed: 84}
|
48
|
+
BARRAGE_DEFAULTS = { gif: false, compress: true, speed: 84 }.freeze
|
49
49
|
|
50
|
-
BRUTE_SORT_SAVE_WITH_SETTINGS_DEFAULTS = {settings: {}, output_name: nil, gif: false,
|
51
|
-
|
52
|
-
IMAGE_DELAY_DEFAULTS = {active: false, image_to_delay: 1, delay_length: 1000}
|
50
|
+
BRUTE_SORT_SAVE_WITH_SETTINGS_DEFAULTS = { settings: {}, output_name: nil, gif: false,
|
51
|
+
output_folder: false }.freeze
|
52
|
+
IMAGE_DELAY_DEFAULTS = { active: false, image_to_delay: 1, delay_length: 1000 }.freeze
|
53
53
|
|
54
|
-
DITHER_DEFAULTS = {active: false, number_of_colors: 200}
|
54
|
+
DITHER_DEFAULTS = { active: false, number_of_colors: 200 }.freeze
|
55
55
|
|
56
|
-
GIF_DEFAULTS = {speed: 84, dither: DITHER_DEFAULTS, image_delay: IMAGE_DELAY_DEFAULTS}
|
56
|
+
GIF_DEFAULTS = { speed: 84, dither: DITHER_DEFAULTS, image_delay: IMAGE_DELAY_DEFAULTS }.freeze
|
57
57
|
end
|
58
58
|
end
|
data/lib/pixel_dreamer.rb
CHANGED
@@ -18,8 +18,7 @@ module PixelDreamer
|
|
18
18
|
include Magick
|
19
19
|
attr_accessor :image, :overlay_image
|
20
20
|
|
21
|
-
def initialize(image, overlay_image = nil)
|
22
|
-
|
21
|
+
def initialize(image, overlay_image = nil, app = false)
|
23
22
|
@image = prepare_image(image)
|
24
23
|
@overlay_image = overlay_image
|
25
24
|
@input_name = name_parser(image)
|
@@ -28,6 +27,15 @@ module PixelDreamer
|
|
28
27
|
@sequence_frame_path = sequence_frame_path
|
29
28
|
@image_path = image_path
|
30
29
|
@output_folder = output_folder
|
30
|
+
@app = app
|
31
|
+
end
|
32
|
+
|
33
|
+
def show_sequence_folder
|
34
|
+
@sequence_folder
|
35
|
+
end
|
36
|
+
|
37
|
+
def show_output_folder
|
38
|
+
@output_folder
|
31
39
|
end
|
32
40
|
|
33
41
|
##
|
@@ -40,10 +48,20 @@ module PixelDreamer
|
|
40
48
|
end_image
|
41
49
|
end
|
42
50
|
|
43
|
-
# pixel sorts
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
51
|
+
# pixel sorts an image and outputs a text file with settings used
|
52
|
+
# once the image has been instantiated you can run this method without passing in any parameters
|
53
|
+
# by default it runs with these paramaters:
|
54
|
+
# { settings: DEFAULTS, output_name: nil, gif: false, output_folder: false }
|
55
|
+
# example:
|
56
|
+
# image.brute_sort_save_with_settings
|
57
|
+
# or with these parameters
|
58
|
+
#
|
59
|
+
# image.brute_sort_save_with_settings(settings: PixelDreamer::Constants::DEFAULTS, output_name: nil, gif: false, output_folder: false)
|
60
|
+
# or
|
61
|
+
# image.brute_sort_save_with_settings(settings: { reverse: false, vertical: false, diagonal: false,
|
62
|
+
# smooth: false, method: 'sum-rgb', verbose: false,
|
63
|
+
# min: Float::INFINITY, max: Float::INFINITY,
|
64
|
+
# trusted: false, middle: false })
|
47
65
|
# also read the documentation for pxlsrt
|
48
66
|
def brute_sort_save_with_settings(options = {})
|
49
67
|
options[:image] ||= @image
|
@@ -100,12 +118,12 @@ module PixelDreamer
|
|
100
118
|
settings[:min] = counter
|
101
119
|
settings[:max] = counter * sequence_settings[:max_multiple]
|
102
120
|
brute_sort_save_with_settings(image: @path, settings: settings, output_name: (output_name + "_#{image_number}"),
|
103
|
-
|
121
|
+
gif: true, output_folder: true)
|
104
122
|
puts "IMAGE #{image_number}/#{sequence_settings[:break_point] - sequence_settings[:counter]} COMPLETE"
|
105
123
|
image_number += 1
|
106
124
|
counter += sequence_settings[:increment]
|
107
125
|
end
|
108
|
-
gif(options)
|
126
|
+
gif(options) if options[:gif]
|
109
127
|
end
|
110
128
|
|
111
129
|
|
@@ -134,7 +152,7 @@ module PixelDreamer
|
|
134
152
|
|
135
153
|
Constants::SETTINGS.each do |key, setting_hash|
|
136
154
|
brute_sort_save_with_settings(image: image, settings: setting_hash, output_name: (output_name + "_#{key}"),
|
137
|
-
|
155
|
+
gif: gif, output_folder: true)
|
138
156
|
puts "Image #{counter}/#{Constants::SETTINGS.length} complete."
|
139
157
|
counter += 1
|
140
158
|
end
|
@@ -162,7 +180,7 @@ module PixelDreamer
|
|
162
180
|
|
163
181
|
options[:image_number].times do
|
164
182
|
brute_sort_save_with_settings(image: image, settings: randomize_settings, output_name: (options[:output_name] + random_name),
|
165
|
-
|
183
|
+
gif: options[:gif], output_folder: true)
|
166
184
|
end
|
167
185
|
end
|
168
186
|
|
@@ -205,15 +223,32 @@ module PixelDreamer
|
|
205
223
|
options[:dither] = Constants::DITHER_DEFAULTS.merge(options[:dither])
|
206
224
|
image_delay = options[:image_delay]
|
207
225
|
dither = options[:dither]
|
208
|
-
|
226
|
+
|
227
|
+
sorted_dir = Dir["#{@sequence_folder}*.png"].sort_by do |x|
|
228
|
+
b = x[/_(\d+)/]
|
229
|
+
if b.nil?
|
230
|
+
0
|
231
|
+
else
|
232
|
+
b.delete('_').to_i
|
233
|
+
end
|
234
|
+
end
|
235
|
+
animation = ImageList.new(*sorted_dir)
|
209
236
|
animation.ticks_per_second=1000
|
210
237
|
puts 'Got images.'
|
211
238
|
animation.delay = options[:speed]
|
212
239
|
animation[(image_delay[:image_to_delay] - 1)].delay = image_delay[:delay_length] if image_delay[:active]
|
213
240
|
puts 'Creating GIF.'
|
214
241
|
animation = dither(animation, dither[:number_of_colors]) if dither[:active]
|
242
|
+
animation = animation.deconstruct if @overlay_image && @app
|
215
243
|
animation.write("#{@output_folder}#{options[:output_name]}.gif")
|
244
|
+
|
245
|
+
if (File.size("#{@output_folder}#{options[:output_name]}.gif") / 1000000) > 8 && @app
|
246
|
+
animation = dither(animation, 256)
|
247
|
+
animation.write("#{@output_folder}#{options[:output_name]}.gif")
|
248
|
+
end
|
249
|
+
|
216
250
|
puts 'Complete.'
|
251
|
+
"#{@output_folder}#{options[:output_name]}.gif"
|
217
252
|
end
|
218
253
|
|
219
254
|
##
|
@@ -255,15 +290,14 @@ module PixelDreamer
|
|
255
290
|
end
|
256
291
|
|
257
292
|
def dither(animation, number_of_colors)
|
258
|
-
animation.quantize(
|
259
|
-
colorspace=RGBColorspace, dither=RiemersmaDitherMethod,
|
260
|
-
tree_depth=0, measure_error=false)
|
293
|
+
animation.quantize(number_of_colors, Magick::RGBColorspace, true, 0, false)
|
261
294
|
end
|
262
295
|
|
263
296
|
def prepare(counter, compress)
|
264
297
|
make_dir?
|
265
298
|
path_selector(counter, compress, image)
|
266
299
|
compress(image, @path) if compress
|
300
|
+
resize!(@path) if @app
|
267
301
|
end
|
268
302
|
|
269
303
|
##
|
@@ -326,17 +360,30 @@ module PixelDreamer
|
|
326
360
|
|
327
361
|
def path_selector(counter, compress, input)
|
328
362
|
if compress
|
329
|
-
if counter > 1
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
363
|
+
@path = if counter > 1
|
364
|
+
@image_path
|
365
|
+
else
|
366
|
+
@sequence_frame_path
|
367
|
+
end
|
334
368
|
else
|
335
369
|
@path = input
|
336
370
|
FileUtils.copy(input, @sequence_frame_path)
|
337
371
|
end
|
338
372
|
end
|
339
373
|
|
374
|
+
def resize!(image_uri)
|
375
|
+
i = Image.read(image_uri).first
|
376
|
+
h = i.columns
|
377
|
+
w = i.rows
|
378
|
+
s = h * w
|
379
|
+
|
380
|
+
if s > 1500000
|
381
|
+
percentage = (1500000.0 / s).round(2)
|
382
|
+
resized = i.resize(percentage)
|
383
|
+
resized.write(image_uri)
|
384
|
+
end
|
385
|
+
end
|
386
|
+
|
340
387
|
##
|
341
388
|
# still being used but partially deprecated
|
342
389
|
def output(base_uri, input_name, output_name, options, gif, output_folder)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixel_dreamer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Samuel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rmagick
|