Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey.afanasiev authored and sergey.afanasiev committed Aug 9, 2017
2 parents df5d007 + f6edd4b commit f7d7749
Showing 1 changed file with 86 additions and 5 deletions.
91 changes: 86 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
## Example
## About

To run the example project, clone the repo, and run `pod install` from the Example directory first.
MediaWatemark is an open source GPU/CPU-based IOS video and image processing library, which helps to render watermarks over image or video content. It has simple interface and straightforward functionality.

## Requirements
## Overview
__Simple & Universal__

MediaWatemark is easy to install and integrate into any iOS project. It processes the wide variety of tasks and goes perfectly for rendering views and texts over the videos or other images.

__Light Code__

MediaWatemark consists of light code and makes it easy to render one image over another, or do the same with the video content.

__Easy Installation__

Before using the library in your work, you may run the example project, I'm sharing below. When you are ready to use it, just follow the short and easy Installation tip below.

Swift 3.1, iOS 9.0

## Installation

Expand All @@ -14,8 +24,20 @@ it, simply add the following line to your Podfile:
```ruby
pod "MediaWatermark"
```
## Requirements

iOS: 9.0+
Swift: 3.1
CocoaPods: for iOS
Processing Concept: GPU & CPU

## Example
To run the example project, clone the repo, and run pod install from the Example directory first.

## Usage
__Adding several images over the other image__

To add two images with different coordinates over the third image, you may use code like the following. The images are placed according to the coordinates you set in the code.

```swift
if let item = MediaItem(url: url) {
Expand All @@ -36,9 +58,68 @@ if let item = MediaItem(url: url) {
}
```

__Adding an image and text over the image__

The next script template will work in case if you need to render an image and text over the other image:

```swift
let item = MediaItem(image: image)

let logoImage = UIImage(named: "logo")

let firstElement = MediaElement(image: logoImage!)
firstElement.frame = CGRect(x: 0, y: 0, width: logoImage!.size.width, height: logoImage!.size.height)

let testStr = "Test Attributed String"
let attributes = [ NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont.systemFont(ofSize: 35) ]
let attrStr = NSAttributedString(string: testStr, attributes: attributes)

let secondElement = MediaElement(text: attrStr)
secondElement.frame = CGRect(x: 300, y: 300, width: logoImage!.size.width, height: logoImage!.size.height)

item.add(elements: [firstElement, secondElement])

let mediaProcessor = MediaProcessor()
mediaProcessor.processElements(item: item) { [weak self] (result, error) in
self?.resultImageView.image = result.image
}
```

__Adding an image and text over the video__

To add an image and text over the video you may refer the following code extract:

```swift
if let item = MediaItem(url: url) {
let logoImage = UIImage(named: "logo")

let firstElement = MediaElement(image: logoImage!)
firstElement.frame = CGRect(x: 0, y: 0, width: logoImage!.size.width, height: logoImage!.size.height)

let testStr = "Attributed Text"
let attributes = [ NSForegroundColorAttributeName: UIColor.white, NSFontAttributeName: UIFont.systemFont(ofSize: 35) ]
let attrStr = NSAttributedString(string: testStr, attributes: attributes)

let secondElement = MediaElement(text: attrStr)
secondElement.frame = CGRect(x: 300, y: 300, width: logoImage!.size.width, height: logoImage!.size.height)

item.add(elements: [firstElement, secondElement])

let mediaProcessor = MediaProcessor()
mediaProcessor.processElements(item: item) { [weak self] (result, error) in
self?.videoPlayer.url = result.processedUrl
self?.videoPlayer.playFromBeginning()
}
}
```

## Author

Sergey Afanasiev, [email protected]
Sergey Afanasiev

## Getting Help

[email protected]

## License

Expand Down

0 comments on commit f7d7749

Please sign in to comment.