bpg 0.0.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bc2d35b79e4803d10877ea7c6a9ba57f2d206f8b
4
+ data.tar.gz: 1de06f06f8058712b17941a8d15d234557901bd8
5
+ SHA512:
6
+ metadata.gz: 16e447e8618fe0236abeb899624f86fc186acce283ac8c63fb0ae855a54fb9b281a1fc987c08274a45573d4ad3b5ad455a3cae7e955ebac98a073b130c68b86b
7
+ data.tar.gz: ccccbbb84a91443aad496c054afd85821992b9288ba612d111b250e34dafbe7c66b21b533e371997fef01b760c59eff5270a8446a2ace6ce8d44a2bf62828e34
@@ -0,0 +1,23 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bpg.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Torsten Braun
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,35 @@
1
+ # BPG Image format for Ruby
2
+
3
+ _This is a development version and not for production environments!_
4
+
5
+ This gem can load JPEG images and return them in BPG format.
6
+
7
+ For this version of the Gem go to [http://bellard.org/bpg/](http://bellard.org/bpg/)
8
+ and install the library on your system. In an other release I want to include the
9
+ library as an native extension.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ gem 'bpg'
16
+
17
+ And then execute:
18
+
19
+ $ bundle
20
+
21
+ Or install it yourself as:
22
+
23
+ $ gem install bpg
24
+
25
+ ## Usage
26
+
27
+ TODO
28
+
29
+ ## Contributing
30
+
31
+ 1. Fork it ( https://github.com/tbraun89/bpg/fork )
32
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
33
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
34
+ 4. Push to the branch (`git push origin my-new-feature`)
35
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bpg/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'bpg'
8
+ spec.version = Bpg::VERSION
9
+ spec.authors = ['Torsten Braun']
10
+ spec.email = ['tbraun@tnt-web-solutions.de']
11
+ spec.summary = %q{Load JPEG files and return them is BPG.}
12
+ spec.description = %q{This library uses libbpg to convert JPEG images to convert them to BPG image format.}
13
+ spec.homepage = 'https://github.com/tbraun89/bpg'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0") + Dir.glob('ext/**/*.{c,rb}')
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler', '~> 1.6'
22
+ spec.add_development_dependency 'rake', '~> 0'
23
+ end
@@ -0,0 +1,8 @@
1
+ bpg:
2
+ config:
3
+ bpgenc: '/usr/local/bin/bpgenc' # bpgenc binary
4
+ quantizer: 28 # 0-51
5
+ chroma: 420 # 420, 422, 444
6
+ color_space: 'ycbcr' # ycbcr, rgb, ycgco
7
+ bit_depth: 10 # 8-12
8
+ lossless: false
@@ -0,0 +1,2 @@
1
+ require 'bpg/version'
2
+ require 'bpg/encoder'
@@ -0,0 +1,8 @@
1
+ module Bpg
2
+ module Config
3
+ require 'yaml'
4
+
5
+ DEFAULT_FILE = File.join(File.dirname(File.expand_path(__FILE__)), '../../config/bpg.yml')
6
+ CONFIG = YAML.load_file(DEFAULT_FILE)['bpg']['config'].inject({}){|m,(k,v)| m[k.to_sym] = v; m}
7
+ end
8
+ end
@@ -0,0 +1,32 @@
1
+ module Bpg
2
+ module Encoder
3
+ require 'tempfile'
4
+ require 'bpg/config'
5
+
6
+ def self.encode_to_file(input_file, output_file, params = {})
7
+ params = Bpg::Config::CONFIG.merge(params)
8
+ options = ''
9
+
10
+ options += "-q #{params[:quantizer]} "
11
+ options += "-f #{params[:chroma]} "
12
+ options += "-c #{params[:color_space]} "
13
+ options += "-b #{params[:bit_depth]} "
14
+ options += '-lossless' if params[:lossless]
15
+
16
+ `#{params[:bpgenc]} -o #{output_file} #{options} #{input_file}`
17
+ end
18
+
19
+ def self.encode(input_file, params = {})
20
+ tmp_output_file = Tempfile.new('bpg')
21
+
22
+ encode_to_file(input_file, tmp_output_file.path, params)
23
+
24
+ tmp_output_file.rewind
25
+ data = tmp_output_file.read
26
+ tmp_output_file.close
27
+ tmp_output_file.unlink
28
+
29
+ data
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ module Bpg
2
+ VERSION = '0.0.1'
3
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bpg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Torsten Braun
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: This library uses libbpg to convert JPEG images to convert them to BPG
42
+ image format.
43
+ email:
44
+ - tbraun@tnt-web-solutions.de
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - bpg.gemspec
55
+ - config/bpg.yml
56
+ - lib/bpg.rb
57
+ - lib/bpg/config.rb
58
+ - lib/bpg/encoder.rb
59
+ - lib/bpg/version.rb
60
+ homepage: https://github.com/tbraun89/bpg
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.2.2
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Load JPEG files and return them is BPG.
84
+ test_files: []