slice_rename 0.4.0 → 0.5.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
  SHA1:
3
- metadata.gz: 7a30f22e2c72925fe806e794b4da03e2ce8ee51b
4
- data.tar.gz: 11a40905eddc45d4cc4e3a6cf3f5917c3a92ca7f
3
+ metadata.gz: 0c39f6bd103c00ab992d7b9c17f6c08b6a0cdf38
4
+ data.tar.gz: 0e337de5de580b2b097cf6305457b42263b34310
5
5
  SHA512:
6
- metadata.gz: a787e7d28d6acf3261455194ce80bc1db732feef67babec7d9e0f31c6c4baa13c1f4371bf20abe8623e25980490c7ebcc115b68a6643b4fc71aed382076fdace
7
- data.tar.gz: dbee5b26778837f1a34cb83731eea93313b5980b2fbba6bcf92d44025e2e43e536a0f18d1ac64bd4848fc9732d09d59144a4d8f3b4c3d2a26e96d6bce64f341f
6
+ metadata.gz: 8f06d1977e0a6a71bdb9cfb41482126cc34ba8b77e15496ce7bbc4c06cd7a89f63c856fbf7a7777dd8201242976650a5ce5f4f8794e56354e3a941df20833763
7
+ data.tar.gz: 060c59b227d0ba97d10b0f6f364a0b8bd8dc7d82696c743989d3ec772c4f64a44c958c7fc5b0860b31e02b84e15fa3360b84e8a92cacc9e4c65b9ee3daa87a75
data/README.md CHANGED
@@ -20,19 +20,55 @@ See the example which is located at `spec/fixtures/config_example.yml`. The
20
20
  suffixes aren't mandatory, if you skip them or don't provide enough it will use
21
21
  an auto generated suffix instead (`_00`).
22
22
 
23
- The option called `collapse_padding` specifies if the padding between images
24
- are collapsed into eachother. Meaning that if the `padding` setting is 2 and
25
- `collapse_padding` is true then it expects all images to be separated by 2
23
+ * `rows` - defaults to `1`
24
+
25
+ The number of rows in the image that you are slicing up or combining.
26
+
27
+ * `columns` - defaults to `1`
28
+
29
+ The number of columns in the image that you are slicing up or combining.
30
+
31
+ * `width` - defaults to `16`
32
+
33
+ The width of the individual slices in your image.
34
+
35
+ * `height` - defaults to `16`
36
+
37
+ The height of the individual slices in yout image.
38
+
39
+ * `padding` - defaults to `0`
40
+
41
+ The padding that is around each individual slice. See `collapse_padding`
42
+ for more details on how the padding works.
43
+
44
+ * `collapse_padding` - defaults to `false`
45
+
46
+ The option called `collapse_padding` specifies if the padding between
47
+ images are collapsed into eachother. Meaning that if the `padding` setting is 2
48
+ and `collapse_padding` is true then it expects all images to be separated by 2
26
49
  pixels. If `collapse_padding` is false it will instead expect 2 pixels around
27
50
  each image resulting in 4 pixels between images but only 2 around the whole
28
51
  image.
29
52
 
30
- Images created by slice_rename do not collapse the padding so
53
+ Images created by slice_rename do not collapse the padding so
31
54
  `collapse_padding` defaults to `false`. If you need the old behaviour simply
32
55
  set it to `true` in your config file.
33
56
 
34
- The sample image is part of a duty free asset pack from
35
- [kenney.nl](http://kenney.nl/).
57
+ * `padding_color` - defaults to `none`
58
+
59
+ The color of the padding around your individual slices. The default is
60
+ transparent, if you want a color pass a hex color code. Keep in mind that you
61
+ need quotes since the `#` character is reserved for comments in YAML.
62
+
63
+ * `background_color` - defaults to `none`
64
+
65
+ The color of the background behind your individual slices. The default
66
+ is transparent, if you want a color pass a hex color code.
67
+
68
+ * `debug` - defaults to `false`
69
+
70
+ When set to true slice_rename will spit out the arguments that get sent
71
+ to ImageMagick, this can be helpful for finding problems.
36
72
 
37
73
  # About Rocket Pants
38
74
  ![Rocket Pants](http://rocketpants.se/logo_xsmall.png)
@@ -47,3 +83,6 @@ tool please consider supporting us by checking out our games. Find out more at
47
83
  3. Commit your changes (`git commit -am 'Add some feature'`)
48
84
  4. Push to the branch (`git push origin my-new-feature`)
49
85
  5. Create new Pull Request
86
+
87
+ The sample image is part of a duty free asset pack from
88
+ [kenney.nl](http://kenney.nl/).
data/Rakefile CHANGED
@@ -30,6 +30,6 @@ namespace :run do
30
30
  end
31
31
 
32
32
  task :char do
33
- ruby '-I ./lib bin/slice_rename spec/fixtures/char4/char4.png -d -c spec/fixtures/config_new.yml'
33
+ ruby '-I ./lib bin/slice_rename spec/fixtures/char4/char4.png -d -k -c spec/fixtures/config_new.yml'
34
34
  end
35
35
  end
data/lib/slice_rename.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  require 'slice_rename/cli'
2
2
 
3
3
  module SliceRename
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.1'
5
5
  end
@@ -27,7 +27,7 @@ module SliceRename
27
27
  puts "Geometry: #{geometry}"
28
28
  end
29
29
 
30
- save_combination(images, output_name, geometry, tile, border)
30
+ save_combination(config, images, output_name, geometry, tile, border)
31
31
  end
32
32
 
33
33
  private
@@ -36,7 +36,7 @@ module SliceRename
36
36
  MiniMagick::Image.open path
37
37
  end
38
38
 
39
- def self.save_combination(input_names, output_name, geometry, tile, border)
39
+ def self.save_combination(config, input_names, output_name, geometry, tile, border)
40
40
  MiniMagick::Tool::Montage.new do |montage|
41
41
  input_names.each do |file_name|
42
42
  montage << file_name
@@ -45,8 +45,8 @@ module SliceRename
45
45
  montage.geometry geometry
46
46
  montage.tile tile
47
47
  montage.border border
48
- montage.bordercolor "none"
49
- montage.background "none"
48
+ montage.bordercolor config.padding_color
49
+ montage.background config.background_color
50
50
  montage << output_name
51
51
  end
52
52
  end
@@ -3,7 +3,8 @@ require 'yaml'
3
3
  module SliceRename
4
4
  class Config
5
5
  attr_accessor :path, :debug
6
- attr_reader :rows, :columns, :width, :height, :padding, :collapse_padding
6
+ attr_reader :rows, :columns, :width, :height, :padding, :collapse_padding,
7
+ :padding_color, :background_color
7
8
 
8
9
  def initialize
9
10
  @path = ''
@@ -15,6 +16,8 @@ module SliceRename
15
16
  @padding = 0
16
17
  @suffixes = []
17
18
  @collapse_padding = false
19
+ @padding_color = 'none'
20
+ @background_color = 'none'
18
21
  end
19
22
 
20
23
  def load(config_path)
@@ -27,6 +30,8 @@ module SliceRename
27
30
  @padding = config.fetch('padding', @padding)
28
31
  @suffixes = config.fetch('suffixes', @suffixes)
29
32
  @collapse_padding = config.fetch('collapse_padding', @collapse_padding)
33
+ @padding_color = config.fetch('padding_color', @padding_color)
34
+ @background_color = config.fetch('background_color', @background_color)
30
35
  end
31
36
 
32
37
  def suffixes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slice_rename
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zoee Silcock
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-30 00:00:00.000000000 Z
11
+ date: 2016-10-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Slice an image and give each slice a specific name.
14
14
  email: mrzoee@gmail.com