All Projects → devxoul → Swiftyimage

devxoul / Swiftyimage

Licence: mit
🎨 Generate image resources in Swift

Programming Languages

swift
15916 projects

Labels

Projects that are alternatives of or similar to Swiftyimage

Ng Lazy Load
Lazy loading images with Angular.
Stars: ✭ 12 (-98.77%)
Mutual labels:  image
Image Relocation
Docker/OCI image relocation
Stars: ✭ 21 (-97.85%)
Mutual labels:  image
React Image Lightbox
React lightbox component
Stars: ✭ 956 (-1.95%)
Mutual labels:  image
Instagrid Js
A Javascript library to do exactly what Instagram Layout application does
Stars: ✭ 13 (-98.67%)
Mutual labels:  image
Ambient
Lightweight ambient light javascript library for HTML image and video elements
Stars: ✭ 20 (-97.95%)
Mutual labels:  image
Fabscanpi Build Raspbian
Build Script for FabScanPi Raspbian Images
Stars: ✭ 21 (-97.85%)
Mutual labels:  image
Disec
Distributed Image Search Engine Crawler
Stars: ✭ 11 (-98.87%)
Mutual labels:  image
Rverify.js
✅❎ A lightweight image rotation verification plugin.
Stars: ✭ 33 (-96.62%)
Mutual labels:  image
Metalpetal
A GPU accelerated image and video processing framework built on Metal.
Stars: ✭ 907 (-6.97%)
Mutual labels:  image
Ruby Gem Downloads Badge
Clean and simple gem downloads count badge, courtesy of http://shields.io/. You can checkout the application directly at the following URL:
Stars: ✭ 29 (-97.03%)
Mutual labels:  image
Flickrsync
A command line tool to synchronise, upload, download, pictures between the local file system and Flickr. Image hash signature of the picture is used to uniquely identify the image.
Stars: ✭ 14 (-98.56%)
Mutual labels:  image
Detection Of Breast Cancer Using Neural Networks
This project is made in Matlab Platform and it detects whether a person has cancer or not by taking into account his/her mammogram.
Stars: ✭ 15 (-98.46%)
Mutual labels:  image
Imageretrieval
Stars: ✭ 28 (-97.13%)
Mutual labels:  image
Laravel Image Optimizer
Optimize images in your Laravel app
Stars: ✭ 873 (-10.46%)
Mutual labels:  image
React Grid Carousel
React responsive carousel component w/ grid layout
Stars: ✭ 29 (-97.03%)
Mutual labels:  image
Minecraft Forge
Docker images for Minecraft Forge
Stars: ✭ 11 (-98.87%)
Mutual labels:  image
Jukeboks
Jukeboks is a fast viewer / player app
Stars: ✭ 21 (-97.85%)
Mutual labels:  image
Photobrowser
Elegant photo browser in Swift. 图片与视频浏览器。
Stars: ✭ 975 (+0%)
Mutual labels:  image
Hard Aware Deeply Cascaed Embedding
source code for the paper "Hard-Aware-Deeply-Cascaed-Embedding"
Stars: ✭ 32 (-96.72%)
Mutual labels:  image
Smartcircle
✂️Automatically determine where to crop a circular image out of a rectangular.
Stars: ✭ 29 (-97.03%)
Mutual labels:  image

SwiftyImage

Swift CocoaPods CI

The most sexy way to use images in Swift.

Features

At a Glance

Creating Images
UIImage.size(width: 100, height: 100)
  .color(.white)
  .border(color: .red)
  .border(width: 10)
  .corner(radius: 20)
  .image

sample1

UIImage.resizable()
  .color(.white)
  .border(color: .blue)
  .border(width: 5)
  .corner(radius: 10)
  .image

sample2

Creating Color Overlayed Image
let image = UIImage(named: "myArrow").with(color: UIColor.blueColor())

Getting Started

SwiftyImage provides a simple way to create images with method chaining.

Step 1. Start Chaining

Method chaining starts from UIImage.size() or UIImage.resizable().

UIImage.size(width: CGFloat, height: CGFloat) // ...
UIImage.size(size: CGSize) // ...
UIImage.resizable() // ...

Step 2. Setting Properties

You can set fill color, border attributes, corner radius, etc.

UIImage.size(width: 100, height: 100)  // fixed size
  .color(.white)                       // fill color
  .border(color: .red)                 // border color
  .border(width: 10)                   // border width
  .corner(radius: 20)                  // corner radius
UIImage.resizable() // resizable image
  .color(.white)
  .border(color: .lightGray)
  .border(width: 1)
  .corner(radius: 5)

Step 3. Generating Image

Use .image at the end of method chaining to generate image.

imageView.image = UIImage.size(width: 100, height: 100)
  .color(.white)
  .border(color: .red)
  .border(width: 10)
  .corner(radius: 20)
  .image  // generate UIImage

Methods Available

Starting Method Chaining

  • .size(width: CGFloat, height: CGFloat)

    Starts chaining for fixed size image

  • .size(CGSize)

    Starts chaining for fixed size image

  • .resizable()

    Starts chaining for resizable image

Setting Properties

  • .color(UIColor)

    Sets fill color

  • .color(gradient: [UIColor], locations: [CGFloat], from: CGPoint, to: CGPoint)

    Sets gradient fill color

    New in version 1.1.0

  • .border(width: CGFloat)

    Sets border width

  • .border(color: UIColor)

    Sets border color

  • .border(gradient: [UIColor], locations: [CGFloat], from: CGPoint, to: CGPoint)

    Sets gradient border color

    New in version 1.1.0

  • .border(alignment: BorderAlignment)

    Sets border alignment. Same with Photoshop's

    available values: .inside, .center, .outside

  • .corner(radius: CGFloat)

    Sets all corners radius of image

  • .corner(topLeft: CGFloat)

    Sets top left corner radius of image

  • .corner(topRight: CGFloat)

    Sets top right corner radius of image

  • .corner(bottomLeft: CGFloat)

    Sets bottom left corner radius of image

  • .corner(bottomRight: CGFloat)

    Sets bottom right corner radius of image

Generating Image

  • .image

    Generates and returns image

Play with CGContext

SwiftyImage also provides a simple method to create or manipulate images with CGContext.

Creating Images

let image = UIImage.with(size: CGSize(width: 100, height: 100)) { context in
  UIColor.lightGrayColor().setFill()
  CGContextFillEllipseInRect(context, CGRect(x: 0, y: 0, width: 100, height: 100))
}

Manipulating Images

let newImage = oldImage.with { context in
  UIColor.lightGrayColor().setFill()
  CGContextFillEllipseInRect(context, CGRect(x: 0, y: 0, width: 100, height: 100))
}

Image Operator

You can easily combine multiple images with + operator.

let backgroundImage = ...
let iconImage = ...
let combinedImage = backgroundImage + iconImage

combine

Installation

pod 'SwiftyImage', '~> 1.1'

Playground

Use CocoaPods command $ pod try SwiftyImage to try Playground!

playground

License

SwiftyImage is under MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].