favicon_maker 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MWRhN2RjOGI4OTRlMWI3ODA5NjYzNjA0MmJhYjllYmUzNmI5Y2Y0MA==
4
+ Y2Y1MGE2ZDQyZGM5NDJiY2MyMTExNTk0MjE4NzAwNzVjZjk3MmRhMw==
5
5
  data.tar.gz: !binary |-
6
- Yjk3YmZhMmZkOGI2NWViZDcyNGZlOTQyMzRlMzNhNThkM2NhNjE4Yw==
6
+ MTUyMjAxZjYzODkwNDEyNTYwODczN2IzMTBhOGE2YzViNDhkODJhNA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDA1ZjE3ZTcxOTE5MjYzYWNmMTMxMDcxNDJiMTM3OWJmYmRkZDEyNDFmM2Yy
10
- MmI0MTdjNzFlODE5N2Y1ZjQwODQ4M2IwZTJiNjEyNDUzOGU5OTc2MDI3NDVk
11
- MDA2YTY0OTQ5YjM1YWE3YjgzNTE5MTBjMmNhN2Q4MTgzNzVmZjc=
9
+ NGZhY2E0Mjk1N2Q4MTZlYWQ5MWQxZDcwMjExYzZkNzM0M2I0OWJjMDBmY2Ri
10
+ ZjZiOTVkZWMyMDExNDNkYjNmOTY0ODQwZTIwNzk5MmI4MWU3OWYxODY5MzIz
11
+ Zjk2ZjgyMWRmYTQ3YTk2ZjMzNWVjOTA0MjU2ODA5MjM0ZmFkNDI=
12
12
  data.tar.gz: !binary |-
13
- YWM3ZTYxYTY3ZWU2YzI2YjcwMTdjYTY5ODNlNTAyYTdjMGUxNDNlN2RlNDM1
14
- MzcxZWRlM2Y2OWE0ZTk5ZWVmMWQzMTM3NThlN2U1MmUyZTdhYTk0MWI0NTM4
15
- MDg5ZTYwNjcxZTYwNzRjYmZhODZhOGI1NDQ2ZDkwYjM2YjZjZDk=
13
+ YWQwNTk0ZGMyNDA0MmYxNDg3ODc5NjdlNjlmYjUyNjJiNTg1NmI2YzFjYWQy
14
+ NDUxNDhiYmU3ODUyMzMyMzUxZjdkNmM4YTRkN2Y0ZjAxZTA1YTRiNDNmZjEz
15
+ ZDFhM2ZlNTQ1YzMyMTE3OWU3Yjk3YjE2ZTZjNWFkNWVjOGY2YzY=
@@ -15,9 +15,21 @@ module FaviconMaker
15
15
  :fav_ico => {:filename => "favicon.ico", :sizes => "64x64,32x32,24x24,16x16", :format => "ico"}
16
16
  }
17
17
 
18
+ IM_VERSION = (`convert --version`).scan(/ImageMagick (\d\.\d\.\d)/).flatten.first
19
+ RECENT_VERSION = "6.8.0"
20
+ COLORSPACE_MIN_VERSION = "6.7.5"
21
+
18
22
  class << self
19
23
 
20
24
  def create_versions(options={}, &block)
25
+
26
+ puts "FaviconMaker: WARNING! Your installed ImageMagick version #{IM_VERSION} is not up-to-date and might produce suboptimal output!" if IM_VERSION < RECENT_VERSION
27
+
28
+ switch_colorspace = IM_VERSION < COLORSPACE_MIN_VERSION
29
+
30
+ colorspace_conv = ["RGB", "sRGB"]
31
+ colorspace_conv.reverse! if switch_colorspace
32
+
21
33
  options = {
22
34
  :versions => ICON_VERSIONS.keys,
23
35
  :custom_versions => {},
@@ -46,20 +58,22 @@ module FaviconMaker
46
58
  FileUtils.cp composed_path, output_file
47
59
  build_mode = :copied
48
60
  else
49
- image = MiniMagick::Image.open(input_file)
50
61
  case version[:format].to_sym
51
62
  when :png
63
+ image = MiniMagick::Image.open(input_file)
52
64
  image.define "png:include-chunk=none,trns,gama"
65
+ image.colorspace colorspace_conv.first
53
66
  image.resize sizes
54
67
  image.format "png"
55
68
  image.strip
69
+ image.colorspace colorspace_conv.last
56
70
  image.write output_file
57
71
  when :ico
58
- ico_cmd = "convert #{input_file} -colorspace RGB "
72
+ ico_cmd = "convert #{input_file} -colorspace #{colorspace_conv.first} "
59
73
  sizes.split(',').sort_by{|s| s.split('x')[0].to_i}.each do |size|
60
- ico_cmd << "\\( -clone 0 -colors 256 -resize #{size} \\) "
74
+ ico_cmd << "\\( -clone 0 -colors 256 -resize #{size} \\) "
61
75
  end
62
- ico_cmd << "-delete 0 -colors 256 -colorspace sRGB #{File.join(output_path, version[:filename])}"
76
+ ico_cmd << "-delete 0 -colors 256 -colorspace #{colorspace_conv.last} #{File.join(output_path, version[:filename])}"
63
77
  puts `#{ico_cmd}`
64
78
  end
65
79
  build_mode = :generated
@@ -1,3 +1,3 @@
1
1
  module FaviconMaker
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: favicon_maker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Follmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-13 00:00:00.000000000 Z
11
+ date: 2013-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_magick
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.0.2
80
+ rubygems_version: 2.0.3
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: Create favicon files in various sizes from a base image