image_voodoo 0.8.9 → 0.9.3

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
- SHA1:
3
- metadata.gz: 525eaa36345ce66a917c101be73299b04e2800cb
4
- data.tar.gz: e851fe90c983c411388d7b1e37ef0c2e323f677b
2
+ SHA256:
3
+ metadata.gz: 3d24878700c42fffc45906b81ad93e9a9a401e37163a1a3681abd43412c63145
4
+ data.tar.gz: 4b6cc8ad69f184f89f59624d932e1f3b7daad8db660565d27086f4186431367d
5
5
  SHA512:
6
- metadata.gz: 02453c98b8e64606ecb01834cebd6d04ba96212377308ca3f4a36f2ab91ae79db59dee0ca1b8056d912b3e66eea71da20d120fb81935d98f6d3a1550e3e57b17
7
- data.tar.gz: 204639d91890c6525a6bae30fd1db9fd61f999187576e5213ac064bc1b8b29e57d3b7412b4ae691e6c1caa9922bdf0659f5535c49a0ebfed9344af5721bdb4db
6
+ metadata.gz: 4ac6d410f3e4eb47a38ba63a631b2485e8fd6896c900b41c4542771061ca0a57ea1f16c6ca905e4907cdf5dd8aeb0184b2c062463f32173a3127a8763f719b68
7
+ data.tar.gz: 3df78c465bffd57c43b0e11434a1ffd9cd6ffff41be4a216546589085d5bb3d0f1c08570e9a4b6653959b5de516dc3230ae8fd2ca1e2650a7f932301a315f885
data/.gitignore CHANGED
@@ -1,2 +1,6 @@
1
1
  /pkg
2
2
  *~
3
+ Gemfile.lock
4
+ lib/image_voodoo_jars.rb
5
+ lib/com
6
+ .idea
data/.rubocop.yml CHANGED
@@ -38,12 +38,12 @@ Metrics/AbcSize:
38
38
  # in a table and then execute lambdas for each orientation but this is much
39
39
  # more clear.
40
40
  Metrics/CyclomaticComplexity:
41
- Max: 9
41
+ Max: 10
42
42
 
43
43
  # A bunch of fields in a hash are basically generated data. Correcting them
44
44
  # for column seems much too pedantic. I guess exclude is the right thing for
45
45
  # an unusual file?
46
- Metrics/LineLength:
46
+ Layout/LineLength:
47
47
  Max: 132
48
48
  Exclude:
49
49
  - 'lib/image_voodoo/metadata.rb'
@@ -69,17 +69,17 @@ Style/SpecialGlobalVars:
69
69
  Enabled: false
70
70
 
71
71
  # I am grouping math and using lack of whitespace for separation.
72
- Style/SpaceAroundOperators:
72
+ Layout/SpaceAroundOperators:
73
73
  Enabled: false
74
74
 
75
75
  # I prefer tight assignment for opt args.
76
- Style/SpaceAroundEqualsInParameterDefault:
76
+ Layout/SpaceAroundEqualsInParameterDefault:
77
77
  Enabled: false
78
78
 
79
79
  # Java methods which override or implement Java method names cannot be switched
80
80
  # to snake case. Do we really need this as a rule anyways? I have never seen
81
81
  # a Rubyist do this as a preferred style?
82
- Style/MethodName:
82
+ Naming/MethodName:
83
83
  Enabled: false
84
84
 
85
85
  # bin/image_voodoo main options block.
@@ -87,14 +87,6 @@ Metrics/BlockLength:
87
87
  Exclude:
88
88
  - 'bin/image_voodoo'
89
89
 
90
- # casecmp for this case seems like it is much less readable in a place where
91
- # performance could never matter (a 3-4 char downcase before processing an
92
- # image :) ). This could end up being important somewhere but as a default
93
- # on it feels weird since I find it less readable.
94
- Performance/Casecmp:
95
- Exclude:
96
- - 'lib/image_voodoo/awt.rb'
97
-
98
90
  # Hash rocket looks much more natural in a rakefile for its deps.
99
91
  Style/HashSyntax:
100
92
  Exclude:
@@ -113,3 +105,61 @@ Style/ParallelAssignment:
113
105
  Metrics/ParameterLists:
114
106
  Exclude:
115
107
  - 'lib/image_voodoo/awt/shapes.rb'
108
+
109
+ # This is complaining that 'x' and 'y' are bad names because they are less
110
+ # than 3 chars. Silly rule even if I appreciate what it is trying to
111
+ # accomplish. Interestingly, in image_voodoo I do use h for height and
112
+ # w for width. Those probably could be written out but they are so common
113
+ # I am basically opting for short-hand. This is something I rarely do except
114
+ # domain-driven code like this (x,y,h,w).
115
+ Naming/MethodParameterName:
116
+ Enabled: false
117
+
118
+ # This represents one of those frustrating dogmatic rules where if I followed
119
+ # this advice I would then violate the column length rule. I specifically
120
+ # use traditional if indented block in cases where if_mod doesn't fit.
121
+ # Gramatically, if_mod can be across two lines but I hate how that looks. The
122
+ # second solution of logical &&/|| change for a raise is alien to for all but
123
+ # assignment.
124
+ Style/IfUnlessModifier:
125
+ Enabled: false
126
+
127
+ # What the hell. Really telling people that encoding: utf-8 should not happen
128
+ # because there are no multi-byte utf-8 characters in it? Why add this noise?
129
+ Style/Encoding:
130
+ Enabled: false
131
+
132
+ # FIXME:
133
+ # This is an unknown error which I should figure out. It must be some
134
+ # StandardError (which is what nothing explicit means) but I should actually
135
+ # be more explicit here.
136
+ Style/RescueStandardError:
137
+ Exclude:
138
+ - 'lib/image_voodoo.rb'
139
+
140
+
141
+ # This was complaining metadata_impl should use @metadata_impl instead of
142
+ # @metadata. I disagree and am unsure why I need to follow this programs
143
+ # opinion on what a good name is? What is commentable is if I change the
144
+ # variable name to @gorgon it still tells me I need to use @metadata_impl.
145
+ # So if I conditionally add any state in any method it will tell me I am
146
+ # memoizing and have to use same ivar as the name of the method? Is it more
147
+ # sophisticated than that? Should I have spent 2-3 minutes trying to figure
148
+ # out how this rule was implemented? :)
149
+ Naming/MemoizedInstanceVariableName:
150
+ Enabled: false
151
+
152
+ # I have two modes of use for private. If it is a small number of individual
153
+ # methods I am explicit and inline the private. If it is a large number of
154
+ # methods especially when the name is fairly obvious that those will be private
155
+ # (like render_impl) then I use block private. Not sure telling me I can only
156
+ # use a single style is very useful.
157
+ Style/AccessModifierDeclarations:
158
+ Enabled: false
159
+
160
+ # I feel for the tiny amount of generation here a better name would not help
161
+ # me understand it better. This is one of those naming rules I feel is
162
+ # probably helpful a minority of the time. Also I have never been confused
163
+ # by what a heredoc text represents because of my heredoc terminator?
164
+ Naming/HeredocDelimiterNaming:
165
+ Enabled: false
data/.travis.yml CHANGED
@@ -3,7 +3,15 @@ language: ruby
3
3
  sudo: false
4
4
 
5
5
  rvm:
6
- - jruby-19mode
6
+ - jruby-head
7
+
8
+ before_install:
9
+ - mkdir rvm_tmp
10
+ - cd rvm_tmp
7
11
 
8
12
  before_script:
9
- - git clone https://github.com/drewnoakes/metadata-extractor-images.git ../metadata-extractor-images
13
+ - cd ..
14
+ - git clone --depth 1 https://github.com/drewnoakes/metadata-extractor-images.git ../metadata-extractor-images
15
+
16
+ install: JRUBY_OPTS=--dev jruby --dev -S bundle install --jobs=3 --retry=3
17
+
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
data/Jars.lock ADDED
@@ -0,0 +1,3 @@
1
+ org.yaml:snakeyaml:1.23:compile:
2
+ com.drewnoakes:metadata-extractor:2.11.0:compile:
3
+ com.adobe.xmp:xmpcore:5.1.3:compile:
data/Rakefile CHANGED
@@ -1,11 +1,21 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler'
2
4
  require 'rake/testtask'
5
+ require 'jars/installer'
3
6
  Bundler::GemHelper.install_tasks
7
+ Bundler.setup
8
+
9
+ task :default => %i[vendor_jars test]
4
10
 
5
- task :default => :test
11
+ desc 'Vendor Jars'
12
+ task :vendor_jars do
13
+ test_file = File.expand_path File.join('lib', 'image_voodoo_jars.rb'), __dir__
14
+ Jars::Installer.vendor_jars! unless File.exist? test_file
15
+ end
6
16
 
7
17
  desc 'Run tests'
8
- task :test do
18
+ task :test => :vendor_jars do
9
19
  Rake::TestTask.new do |t|
10
20
  t.libs << 'lib:vendor'
11
21
  t.test_files = FileList['test/test*.rb']
data/bin/image_voodoo CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  #!/usr/bin/env ruby
2
4
 
3
5
  require 'optparse'
@@ -40,6 +42,12 @@ opts = OptionParser.new do |o|
40
42
  actions << ->(img) { img.add_border(options) }
41
43
  end
42
44
 
45
+ o.on('-c', '--crop X,Y,WIDTH,HEIGHT', 'Crop the image') do |args|
46
+ x, y, width, height = args.split(/,/).map(&:to_i)
47
+
48
+ actions << ->(img) { img.crop(x, y, width, height) }
49
+ end
50
+
43
51
  o.on('-d', '--dimensions', 'Print the image dimensions') do
44
52
  actions << ->(img) { img.tap { puts "#{img.width}x#{img.height}" } }
45
53
  end
@@ -106,7 +114,7 @@ opts = OptionParser.new do |o|
106
114
  end
107
115
 
108
116
  o.on('--pop', 'Revert back to the previous image') do
109
- actions << ->() { images.pop || original_image }
117
+ actions << -> { images.pop || original_image }
110
118
  end
111
119
 
112
120
  o.on('-f', '--format', 'Print the image format') do
data/image_voodoo.gemspec CHANGED
@@ -1,6 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
+ # frozen_string_literal: true
2
3
 
3
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
4
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
5
  require 'image_voodoo/version'
5
6
 
6
7
  Gem::Specification.new do |s|
@@ -13,11 +14,16 @@ Gem::Specification.new do |s|
13
14
  s.summary = 'Image manipulation in JRuby with ImageScience compatible API'
14
15
  s.description = 'Image manipulation in JRuby with ImageScience compatible API'
15
16
 
16
- s.rubyforge_project = 'image_voodoo'
17
-
18
17
  s.files = `git ls-files`.split("\n")
19
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
20
19
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
20
  s.require_paths = %w[lib vendor]
22
- s.has_rdoc = true
21
+
22
+ s.add_development_dependency 'jar-dependencies'
23
+ s.add_development_dependency 'rake'
24
+ s.add_development_dependency 'rubocop'
25
+ s.add_development_dependency 'ruby-maven'
26
+ s.add_development_dependency 'test-unit'
27
+
28
+ s.requirements << 'jar com.drewnoakes, metadata-extractor, 2.11.0'
23
29
  end
data/lib/image_science.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_voodoo'
2
4
  # HA HA...let the pin-pricking begin
3
5
  ImageScience = ImageVoodoo
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'java'
2
4
 
3
5
  # Hide in ImageVoodoo so awt.rb can see this and we will not polute global
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'java'
2
4
 
3
5
  # Hide in ImageVoodoo so awt.rb can see this and we will not polute global
@@ -6,10 +8,6 @@ class ImageVoodoo
6
8
 
7
9
  # Re-open to add convenience methods.
8
10
  class Graphics2D
9
- def jtranslate(x, y)
10
- java_send :translate, [::Java.int, ::Java.int], x, y
11
- end
12
-
13
11
  def draw_this_image(image)
14
12
  draw_image image, 0, 0, nil
15
13
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageVoodoo
2
4
  # (Experimental) An attempt at some primitive drawing in images.
3
5
  module Shapes
@@ -14,7 +16,7 @@ class ImageVoodoo
14
16
  border_width = options[:width].to_i || 2
15
17
  new_width, new_height = width + 2*border_width, height + 2*border_width
16
18
  target = paint(BufferedImage.new(new_width, new_height, color_type)) do |g|
17
- paint_border(g, new_width, new_height, options[:color])
19
+ paint_border(g, new_width, new_height, options)
18
20
  g.draw_image(@src, nil, border_width, border_width)
19
21
  end
20
22
  block_given? ? yield(target) : target
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_voodoo/awt/core_ext/buffered_image'
2
4
  require 'image_voodoo/awt/core_ext/graphics2d'
3
5
  require 'image_voodoo/awt/shapes'
@@ -132,7 +134,9 @@ class ImageVoodoo
132
134
 
133
135
  def determine_format_from_file_name(file_name)
134
136
  ext = file_name.split('.')[-1]
137
+
135
138
  raise ArgumentError, "no extension in file name #{file_name}" unless ext
139
+
136
140
  ext
137
141
  end
138
142
 
@@ -180,9 +184,11 @@ class ImageVoodoo
180
184
 
181
185
  # Converts a RGB hex value into a java.awt.Color object or dies trying
182
186
  # with an ArgumentError.
183
- def hex_to_color(rgb='00000')
184
- rgb = '000000' unless rgb
187
+ def hex_to_color(rgb='000000')
188
+ rgb ||= '000000'
189
+
185
190
  raise ArgumentError, 'hex rrggbb needed' if rgb !~ /[[:xdigit:]]{6,6}/
191
+
186
192
  Color.new(rgb[0, 2].to_i(16), rgb[2, 2].to_i(16), rgb[4, 2].to_i(16))
187
193
  end
188
194
 
@@ -248,9 +254,10 @@ class ImageVoodoo
248
254
  when 2 then flip_horizontally
249
255
  when 3 then rotate(180)
250
256
  when 4 then flip_vertically
251
- when 5 then flip_horizontally && rotate(270)
257
+ when 5 then flip_horizontally && rotate(90)
252
258
  when 6 then rotate(90)
253
259
  when 7 then flip_horizontally && rotate(270)
260
+ when 8 then rotate(270)
254
261
  else self
255
262
  end
256
263
  end
@@ -290,7 +297,7 @@ class ImageVoodoo
290
297
  def rotate_impl(radians)
291
298
  new_width, new_height = rotate_new_dimensions(radians)
292
299
  paint_new_buffered_image(new_width, new_height) do |g|
293
- g.jtranslate (new_width - width) / 2, (new_height - height) / 2
300
+ g.translate (new_width - width) / 2, (new_height - height) / 2
294
301
  g.rotate radians, width / 2, height / 2
295
302
  g.draw_this_image @src
296
303
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Google App Engine implementation (does this work?)
2
4
  class ImageVoodoo
3
5
  java_import com.google.appengine.api.images.Image
@@ -1,5 +1,7 @@
1
- require_relative '../../vendor/xmpcore-5.1.2.jar'
2
- require_relative '../../vendor/metadata-extractor-2.7.0.jar'
1
+ # frozen_string_literal: true
2
+
3
+ require 'image_voodoo_jars'
4
+ require 'stringio'
3
5
 
4
6
  class ImageVoodoo
5
7
  # Metadata contained within the image.
@@ -19,7 +21,9 @@ class ImageVoodoo
19
21
  #
20
22
  def [](dirname)
21
23
  dirclass = DIRECTORY_MAP[dirname.to_s]
24
+
22
25
  raise ArgumentError, "Uknown metadata group: #{dirname}" unless dirclass
26
+
23
27
  dirclass.new @metadata
24
28
  end
25
29
 
@@ -46,6 +50,18 @@ class ImageVoodoo
46
50
  def width
47
51
  self['Exif Sub IFD']['Exif Image Width']
48
52
  end
53
+
54
+ def to_s
55
+ out = StringIO.new
56
+ out.puts "[{dir name}] - {tag name} = {tag descr}"
57
+ out.puts "---------------------------------------"
58
+ @metadata.directories.each do |directory|
59
+ directory.tags.each do |tag|
60
+ out.puts "[#{directory.name}] - #{tag.tag_name} = #{tag.description}"
61
+ end
62
+ end
63
+ out.string
64
+ end
49
65
  end
50
66
 
51
67
  # All metadata are contained within Directories. An image may have n
@@ -54,7 +70,8 @@ class ImageVoodoo
54
70
  # directory.
55
71
  class Directory
56
72
  def initialize(metadata)
57
- @directory = metadata.get_directory self.class.directory_class.java_class
73
+ jclass = self.class.directory_class.java_class
74
+ @directory = metadata.get_first_directory_of_type jclass
58
75
  end
59
76
 
60
77
  ##
@@ -68,10 +85,15 @@ class ImageVoodoo
68
85
  # defined.
69
86
  def [](tag_name)
70
87
  return nil unless @directory
88
+
71
89
  (tag_type, tag_method) = self.class::TAGS[tag_name.to_s]
90
+
72
91
  raise ArgumentError, "Unkown tag_name: #{tag_name}" unless tag_type
92
+
73
93
  java_tag_type = self.class.directory_class.const_get tag_type
94
+
74
95
  return nil unless @directory.contains_tag java_tag_type
96
+
75
97
  @directory.__send__ tag_method, java_tag_type
76
98
  end
77
99
  end
@@ -1 +1,3 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageVoodoo; NEEDS_HEAD = true; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ImageVoodoo
2
- VERSION = '0.8.9'.freeze
4
+ VERSION = '0.9.3'
3
5
  end
data/lib/image_voodoo.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Before we load image_voodoo we can specify whether we want it to load full
2
4
  # AWT ala http://www.oracle.com/technetwork/articles/javase/headless-136834.html
3
5
  # Most users are using image_voodoo as a library for manipulation and do not
@@ -31,7 +33,7 @@ end
31
33
  # img = ImageVoodoo.with_image(ARGV[0])
32
34
  # negative_img = img.negative
33
35
  class ImageVoodoo
34
- attr_accessor :quality
36
+ attr_writer :quality # used by quality(value)
35
37
 
36
38
  include Java
37
39
 
@@ -92,15 +94,21 @@ class ImageVoodoo
92
94
  block_given? ? yield(target) : target
93
95
  end
94
96
 
97
+ # crops part of an image
98
+ def crop(x, y, width, height)
99
+ target = with_crop(x, y, x + width, y + height)
100
+ block_given? ? yield(target) : target
101
+ end
102
+
95
103
  # Creates a square thumbnail of the image cropping the longest edge to
96
104
  # match the shortest edge, resizes to size, and yields/returns the new image.
97
105
  def cropped_thumbnail(size)
98
- l, t, r, b = calculate_thumbnail_dimentions
106
+ l, t, r, b = calculate_thumbnail_dimensions
99
107
  target = with_crop(l, t, r, b).thumbnail(size)
100
108
  block_given? ? yield(target) : target
101
109
  end
102
110
 
103
- def calculate_thumbnail_dimensions
111
+ private def calculate_thumbnail_dimensions
104
112
  half = (width - height).abs / 2
105
113
  if width > height
106
114
  [half, 0, half + height, height]
@@ -108,7 +116,6 @@ class ImageVoodoo
108
116
  [0, half, width, half + width]
109
117
  end
110
118
  end
111
- private :calculate_thumbnail_dimensions
112
119
 
113
120
  # Flips the image horizontally and yields/returns the new image.
114
121
  def flip_horizontally
@@ -157,8 +164,8 @@ class ImageVoodoo
157
164
  def resize(width, height)
158
165
  target = guard { resize_impl(width, height) }
159
166
  block_given? ? yield(target) : target
160
- rescue NativeException => ne
161
- raise ArgumentError, ne.message
167
+ rescue java.lang.Exception => e # figure out why this is here at all?
168
+ raise ArgumentError, e.message
162
169
  end
163
170
 
164
171
  # Rotates the image by angle (specified in degrees).
@@ -172,6 +179,7 @@ class ImageVoodoo
172
179
  def save(file)
173
180
  format = File.extname(file)
174
181
  return false if format == ''
182
+
175
183
  format = format[1..-1].downcase
176
184
  guard { save_impl(format, JFile.new(file)) }
177
185
  true
@@ -208,6 +216,7 @@ class ImageVoodoo
208
216
  # A top-level image loader opens path and then yields/returns the image.
209
217
  def self.with_image(path)
210
218
  raise ArgumentError, "file does not exist: #{path}" unless File.file?(path)
219
+
211
220
  image = guard { with_image_impl(JFile.new(path)) }
212
221
  image && block_given? ? yield(image) : image
213
222
  end
@@ -227,7 +236,7 @@ class ImageVoodoo
227
236
  # support it. Otherwise, this method will detect that the method is
228
237
  # missing.
229
238
  def self.guard(&block)
230
- return block.call
239
+ block.call
231
240
  rescue NoMethodError => e
232
241
  "Unimplemented Feature: #{e}"
233
242
  end
data/samples/bench.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/local/bin/ruby -w
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'benchmark'
4
5
  require 'rbconfig'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_voodoo'
2
4
 
3
5
  # reads in the file specified by ARGV[0], transforming to greyscale and
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_science'
2
4
 
3
5
  # reads in the file specified by ARGV[0], transforms it into a 32-pixel thumbnail,
data/samples/file_view.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_voodoo/needs_head'
2
4
  require 'image_voodoo'
3
5
 
data/samples/in_memory.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_voodoo'
2
4
 
3
5
  # reads in the image at ARGV[0], transforms it into a 32-pixel thumbnail in-memory,
data/samples/lossy.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'image_voodoo'
2
4
 
3
5
  ImageVoodoo.with_image(ARGV[0]) do |img|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test/unit/testcase'
2
4
  require 'test/unit' if $PROGRAM_NAME == __FILE__
3
5
  require 'image_science'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test/unit/testcase'
2
4
  require 'test/unit' if $PROGRAM_NAME == __FILE__
3
5
  require 'image_voodoo'
@@ -24,7 +26,7 @@ class TestImageVoodoo < Test::Unit::TestCase
24
26
  def lower_right
25
27
  [10, 10]
26
28
  end
27
-
29
+
28
30
  def upper_left
29
31
  [0, 0]
30
32
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test/unit/testcase'
2
4
  require 'test/unit' if $PROGRAM_NAME == __FILE__
3
5
  require 'image_voodoo'
@@ -13,8 +15,8 @@ if !File.exist? IMAGE_DIR
13
15
  else
14
16
  class TestImageVoodooMetadata < Test::Unit::TestCase
15
17
  def setup
16
- @path = File.join IMAGE_DIR, 'Apple iPhone 4S.jpg'
17
- @path_gps = File.join IMAGE_DIR, 'Apple iPhone 4.jpg'
18
+ @path = File.join IMAGE_DIR, 'jpg', 'Apple iPhone 4S.jpg'
19
+ @path_gps = File.join IMAGE_DIR, 'jpg', 'Apple iPhone 4.jpg'
18
20
  @path_no_exif = File.join File.dirname(__FILE__), 'pix.png'
19
21
  end
20
22
 
@@ -53,5 +55,11 @@ else
53
55
  assert_equal('N', img.metadata[:Gps]['Latitude Ref'])
54
56
  end
55
57
  end
58
+
59
+ def test_metadata_to_s
60
+ ImageVoodoo.with_image @path do |img|
61
+ assert img.metadata.to_s =~ /Make = Apple/
62
+ end
63
+ end
56
64
  end
57
65
  end
data/test/test_shapes.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'test/unit/testcase'
2
4
  require 'test/unit' if $PROGRAM_NAME == __FILE__
3
5
  require 'image_voodoo'
data/tools/gen.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Used to generate part of metadata.rb. Unfortunately, I am unable to fill
2
4
  # in appropriate access methods so I generate with get_string and then manually
3
5
  # update. In future versions I will just run this twice with old and new src
@@ -30,6 +32,7 @@ directories = {}
30
32
  io.readlines.each do |line|
31
33
  # .../IptcDirectory.java: public static final int TAG_BY_LINE = 80;
32
34
  next if %r{Source/[/]?(?<dir_name>.*).java:.*TAG_(?<tag_name>[\S]+)} !~ line
35
+
33
36
  directory_name = normalize_directory_name dir_name
34
37
  directories[directory_name] ||= []
35
38
  directories[directory_name] << normalize_tag_name(tag_name)
metadata CHANGED
@@ -1,15 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_voodoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.9
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas E. Enebo, Charles Nutter, Nick Sieger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-06 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ name: jar-dependencies
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ name: rake
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ name: rubocop
48
+ prerelease: false
49
+ type: :development
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ name: ruby-maven
62
+ prerelease: false
63
+ type: :development
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ name: test-unit
76
+ prerelease: false
77
+ type: :development
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
13
83
  description: Image manipulation in JRuby with ImageScience compatible API
14
84
  email: tom.enebo@gmail.com
15
85
  executables:
@@ -22,7 +92,9 @@ files:
22
92
  - ".hgtags"
23
93
  - ".rubocop.yml"
24
94
  - ".travis.yml"
95
+ - Gemfile
25
96
  - History.txt
97
+ - Jars.lock
26
98
  - LICENSE-2.0.txt
27
99
  - LICENSE.txt
28
100
  - Manifest.txt
@@ -56,12 +128,10 @@ files:
56
128
  - test/test_shapes.rb
57
129
  - tools/gen.rb
58
130
  - vendor/CMYKDemo.jar
59
- - vendor/metadata-extractor-2.7.0.jar
60
- - vendor/xmpcore-5.1.2.jar
61
131
  homepage: http://github.com/jruby/image_voodoo
62
132
  licenses: []
63
133
  metadata: {}
64
- post_install_message:
134
+ post_install_message:
65
135
  rdoc_options: []
66
136
  require_paths:
67
137
  - lib
@@ -76,10 +146,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
146
  - - ">="
77
147
  - !ruby/object:Gem::Version
78
148
  version: '0'
79
- requirements: []
80
- rubyforge_project: image_voodoo
81
- rubygems_version: 2.5.2
82
- signing_key:
149
+ requirements:
150
+ - jar com.drewnoakes, metadata-extractor, 2.11.0
151
+ rubygems_version: 3.2.29
152
+ signing_key:
83
153
  specification_version: 4
84
154
  summary: Image manipulation in JRuby with ImageScience compatible API
85
155
  test_files:
Binary file
Binary file