GithubHelp home page GithubHelp logo

marinehero / chopchop Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pavankataria/chopchop

0.0 2.0 0.0 479 KB

Chop an image to as many quadrants as you like at compile time. Great for dynamic content, suitable for games and image processing. .

License: MIT License

Swift 100.00%

chopchop's Introduction

ChopChop

Description

Chop an image to as many quadrants as you like at compile time. Suitable for games and image processing.

Great for dynamic content, s

Here's what you can do with this package:

  • You can crop an image into a square
  • You can crop an image into as many quadrants as you like, by specifying the number of rows and columns, a matrix.

Screenshots of Demo

### Demo A demo is available which allows you: - to pick an image, - specify your matrix - and view your chopped up image into a nice collection view

Installation

There isn't a cocoapod for this package as of today, didn't have the time to do so just yet. For now, simply dragging the single source file into your project is all that's required.

How to use

You simply have an instance of a UIImage you loaded yourself, from somewhere, anywhere:

    var myImage = UIImage(imageNamed:"maybe from the assets, or the image picker class")

Define and instantiate an array which will hold your cropped UIImages

    var images = [UIImage]()

You can either crop your image into a nice square

    var profileImageView.image = myImage.cropToSquare()

Or if you want to make a game or something and require your images to be cropped up into equal quadrants then simply pass a matrix into the cropWithMatrix method. You need to insert a tuple which consists of two ints which are attributed to rows and columns.

        let rowsNum = 2
        let colsNum = 2
        images = image.cropWithMatrix((rowsNum, colsNum))

You'll then get your very own images array which contains your cropped/chopped up image.

To-dos

  • Implement background processing within the package
  • Add more helper functions to the PKImageMatrixCropper
  • Write Tests

Roadmap

  • We are open to new and awesome ideas, contribute if you like! :)

Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create pull request

License

ChopChop is available under the MIT license.

chopchop's People

Contributors

pavankataria avatar marinehero avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.