image_voodoo 0.8.5 → 0.8.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9c58e8e0f8b9c9388e30b313dc18e6cc3b9bea0
4
- data.tar.gz: bcf41a5a7f38c576b3c95323ca0e486e3288223a
3
+ metadata.gz: 05fad5e0d03bf3bb9b5e00e891cf42195a2da7e5
4
+ data.tar.gz: 690d86a449b4ba579d1c1c75c3690a9ec6020934
5
5
  SHA512:
6
- metadata.gz: 0e6ea0d28e142e9092454ea8e40ab5d87c8a099924611423660e8c496802854df38c5c7b403512d20a9039a6addd14178f0076819af09b1e59cdfafd6dbabe77
7
- data.tar.gz: dee71d6424b06ae4fd2f19557ad4374eb8edc6763c7425a47c9b347d742c8c16dd6b421309310942c40d6def9c6ab208c5099e03cd1759ce467ccec314a8e01c
6
+ metadata.gz: ca9c398db76f6a2c0fe1f85e072f18bae35d045d707d6ba7e0acb96c9fbe0c9687d9096b9958fb16bb7f221525b0ffcbdc6fb554f8edfb04b5b6a62cadd4d93e
7
+ data.tar.gz: 72fa3952dd8f9e828cefdfbc5079ada1979b4be5a1ef65f758e37b82af8403e753464ad4504b825986fe76e8c4211d0f1193105650e654bb813469e9bf9ae26d
data/README.md CHANGED
@@ -11,6 +11,8 @@ http://github.com/jruby/image_voodoo
11
11
 
12
12
  * Uses java.awt and javax.image APIs native to Java to perform image manipulation; no other dependencies needed.
13
13
  * Includes image_voodoo command-line utility for quick resizing of images, "image_voodoo --help" for usage.
14
+ * Due to lack of TIFF support in ImageIO it is also not supported yet by image_voodoo. If you need it, create an issue in GitHub.
15
+ * **JPEG CMYK support** is thanks to work of Werner Randelshofer and [Monte Media Library](http://www.randelshofer.ch/monte/). Monte Media Library is provided under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/) license.
14
16
 
15
17
  ## SYNOPSIS:
16
18
 
@@ -17,6 +17,6 @@ Gem::Specification.new do |s|
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.require_paths = ["lib"]
20
+ s.require_paths = ["lib", "vendor"]
21
21
  s.has_rdoc = true
22
22
  end
@@ -18,6 +18,11 @@ class ImageVoodoo
18
18
  java_import javax.imageio.ImageWriteParam
19
19
  java_import javax.imageio.stream.FileImageOutputStream
20
20
  java_import javax.swing.JFrame
21
+ java_import javax.imageio.IIOException
22
+
23
+ require 'CMYKDemo.jar'
24
+ java_import org.monte.media.jpeg.CMYKJPEGImageReader
25
+ java_import org.monte.media.jpeg.CMYKJPEGImageReaderSpi
21
26
 
22
27
  # FIXME: Move and rewrite in terms of new shape
23
28
  ##
@@ -141,10 +146,18 @@ class ImageVoodoo
141
146
 
142
147
  def self.with_image_impl(file)
143
148
  format = detect_format_from_input(file)
144
- buffered_image = ImageIO.read(file)
149
+ buffered_image = read_image_from_input(file)
145
150
  buffered_image ? ImageVoodoo.new(buffered_image, format) : nil
146
151
  end
147
152
 
153
+ def self.read_image_from_input(input)
154
+ ImageIO.read(input)
155
+ rescue IIOException
156
+ cmyk_reader = CMYKJPEGImageReader.new(CMYKJPEGImageReaderSpi.new)
157
+ cmyk_reader.setInput(ImageIO.createImageInputStream(input))
158
+ cmyk_reader.read(0)
159
+ end
160
+
148
161
  def self.detect_format_from_input(input)
149
162
  stream = ImageIO.createImageInputStream(input)
150
163
  readers = ImageIO.getImageReaders(stream)
@@ -154,7 +167,8 @@ class ImageVoodoo
154
167
  def self.with_bytes_impl(bytes)
155
168
  input_stream = ByteArrayInputStream.new(bytes)
156
169
  format = detect_format_from_input(input_stream)
157
- ImageVoodoo.new(ImageIO.read(input_stream), format)
170
+ input_stream.reset
171
+ ImageVoodoo.new(read_image_from_input(input_stream), format)
158
172
  end
159
173
 
160
174
  #
@@ -1,3 +1,3 @@
1
1
  class ImageVoodoo
2
- VERSION = "0.8.5"
2
+ VERSION = "0.8.6"
3
3
  end
@@ -142,6 +142,7 @@ class TestImageScience < Test::Unit::TestCase
142
142
  bytes_string = img.bytes('JPEG')
143
143
  image = ImageScience.with_bytes(bytes_string)
144
144
  assert_equal 'JPEG', image.format
145
+ assert image.to_java.is_a?(java.awt.image.BufferedImage), "JAVA representation of image should be a BufferedImage instance"
145
146
  end
146
147
  end
147
148
 
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_voodoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.5
4
+ version: 0.8.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas E. Enebo, Charles Nutter, Nick Sieger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-26 00:00:00.000000000 Z
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Image manipulation in JRuby with ImageScience compatible API
14
14
  email: tom.enebo@gmail.com
@@ -42,6 +42,7 @@ files:
42
42
  - samples/lossy.rb
43
43
  - test/pix.png
44
44
  - test/test_image_science.rb
45
+ - vendor/CMYKDemo.jar
45
46
  homepage: http://github.com/jruby/image_voodoo
46
47
  licenses: []
47
48
  metadata: {}
@@ -49,6 +50,7 @@ post_install_message:
49
50
  rdoc_options: []
50
51
  require_paths:
51
52
  - lib
53
+ - vendor
52
54
  required_ruby_version: !ruby/object:Gem::Requirement
53
55
  requirements:
54
56
  - - ">="