scrambled_jpeg 0.1.0
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 +7 -0
 - data/.gitignore +14 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +41 -0
 - data/Rakefile +1 -0
 - data/bin/scrambled_jpeg +4 -0
 - data/example.gif +0 -0
 - data/example.jpg +0 -0
 - data/lib/scrambled_jpeg/version.rb +3 -0
 - data/lib/scrambled_jpeg.rb +14 -0
 - data/scrambled_jpeg.gemspec +24 -0
 - metadata +84 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0a7fbf2cc8f76435ca87a74c45111625570666cc
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8a8b54c1d5803689e46101a378953bce1696d9bd
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 854183fae53be02d59815d645f575854885182f4f86ce42018424e20892c25d7f857902aca33ee490b41c6fd0c1007357e564c16a36b8b6a5def4aaa17e53677
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4c3271feb18df499c712c5ba44c0a377200c5c38a2131ed12831258b537288cba7bc9dfdcfa55361c639d009d772a411eedb9e9448801574e44dc634c0d9daf1
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2014 Cole Willsea
         
     | 
| 
      
 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.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # ScrambledJpeg
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Super simple jpeg glitcher.
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            [Here is a pretty good tutorial](http://www.docpop.org/2014/01/a-glitch-primer-editing-image-files-with-text-editors/) that covers the logic behind this and [this looks like a good list](http://phillipstearns.wordpress.com/glitch-art-resources/) of resources for other forms of glitch art.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ### SCRAMBLE ALGORITHM
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            0. Reads a .jpg/.jpeg file
         
     | 
| 
      
 12 
     | 
    
         
            +
            0. Writes first line of original to new file to preserve headers
         
     | 
| 
      
 13 
     | 
    
         
            +
            0. Stores last line of original to preserve EOF
         
     | 
| 
      
 14 
     | 
    
         
            +
            0. Writes GRANULARITY lines of original to new file
         
     | 
| 
      
 15 
     | 
    
         
            +
            0. Caches GRANULARITY lines of original
         
     | 
| 
      
 16 
     | 
    
         
            +
            0. Writes GRANULARITY lines of original to new file
         
     | 
| 
      
 17 
     | 
    
         
            +
            0. Writes the cache to new file
         
     | 
| 
      
 18 
     | 
    
         
            +
            0. ETC.
         
     | 
| 
      
 19 
     | 
    
         
            +
            0. When it runs out of lines to write, it writes the last line and closes the new file.
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                $ gem install scrambled_jpeg
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ## CLI Usage
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                # granularity defaults to 5.
         
     | 
| 
      
 28 
     | 
    
         
            +
                $ scrambled_jpeg [FILENAME] ([GRANULARITY])
         
     | 
| 
      
 29 
     | 
    
         
            +
                $ scrambled_jpeg example.jpg
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                # numbers have differing effects depending on file size and stuff...sometimes it breaks the image...
         
     | 
| 
      
 32 
     | 
    
         
            +
                $ scrambled_jpeg example.jpg 50
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            ## THE FUTURE
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            other potential glitch algorithms:
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            0. Benedict
         
     | 
| 
      
 39 
     | 
    
         
            +
            0. Poach
         
     | 
| 
      
 40 
     | 
    
         
            +
            0. HardBoil
         
     | 
| 
      
 41 
     | 
    
         
            +
            0. Omelette
         
     | 
    
        data/Rakefile
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "bundler/gem_tasks"
         
     | 
    
        data/bin/scrambled_jpeg
    ADDED
    
    
    
        data/example.gif
    ADDED
    
    | 
         Binary file 
     | 
    
        data/example.jpg
    ADDED
    
    | 
         Binary file 
     | 
| 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'scrambled_jpeg/version'
         
     | 
| 
      
 2 
     | 
    
         
            +
            module ScrambledJpeg
         
     | 
| 
      
 3 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 4 
     | 
    
         
            +
                def scramble filename, grain
         
     | 
| 
      
 5 
     | 
    
         
            +
                  ending, cache = (store = File.readlines filename).pop, []
         
     | 
| 
      
 6 
     | 
    
         
            +
                  (new_file = File.open Time.now.hash.to_s + '.jpg', "w").write store.shift
         
     | 
| 
      
 7 
     | 
    
         
            +
                  (grain || 5).times { new_file.write store.shift }
         
     | 
| 
      
 8 
     | 
    
         
            +
                       .times {       cache << store.shift }
         
     | 
| 
      
 9 
     | 
    
         
            +
                       .times { new_file.write store.shift }
         
     | 
| 
      
 10 
     | 
    
         
            +
                       .times { new_file.write cache.shift } until store.empty? && cache.empty?
         
     | 
| 
      
 11 
     | 
    
         
            +
                  new_file.write ending && new_file.close
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'scrambled_jpeg/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "scrambled_jpeg"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = ScrambledJpeg::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["Cole Willsea"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["coleww@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary       = %q{a ruby gem for scrambling jpeg/jpg files as though there were eggs.}
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description   = %q{lalala}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.homepage      = ""
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.executables   = ['scrambled_jpeg']
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.required_ruby_version = '>= 2.0.0'
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.7"
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,84 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: scrambled_jpeg
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Cole Willsea
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-10-26 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.7'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.7'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - ~>
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            description: lalala
         
     | 
| 
      
 42 
     | 
    
         
            +
            email:
         
     | 
| 
      
 43 
     | 
    
         
            +
            - coleww@gmail.com
         
     | 
| 
      
 44 
     | 
    
         
            +
            executables:
         
     | 
| 
      
 45 
     | 
    
         
            +
            - scrambled_jpeg
         
     | 
| 
      
 46 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 47 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 48 
     | 
    
         
            +
            files:
         
     | 
| 
      
 49 
     | 
    
         
            +
            - .gitignore
         
     | 
| 
      
 50 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 51 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 52 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 53 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 54 
     | 
    
         
            +
            - bin/scrambled_jpeg
         
     | 
| 
      
 55 
     | 
    
         
            +
            - example.gif
         
     | 
| 
      
 56 
     | 
    
         
            +
            - example.jpg
         
     | 
| 
      
 57 
     | 
    
         
            +
            - lib/scrambled_jpeg.rb
         
     | 
| 
      
 58 
     | 
    
         
            +
            - lib/scrambled_jpeg/version.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - scrambled_jpeg.gemspec
         
     | 
| 
      
 60 
     | 
    
         
            +
            homepage: ''
         
     | 
| 
      
 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: 2.0.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.0.14
         
     | 
| 
      
 81 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 82 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 83 
     | 
    
         
            +
            summary: a ruby gem for scrambling jpeg/jpg files as though there were eggs.
         
     | 
| 
      
 84 
     | 
    
         
            +
            test_files: []
         
     |