All Projects → rubygarage → Media Watermark

rubygarage / Media Watermark

Licence: mit
GPU/CPU-based iOS Watermark Library for Image and Video Overlay

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Media Watermark

Metalpetal
A GPU accelerated image and video processing framework built on Metal.
Stars: ✭ 907 (+433.53%)
Mutual labels:  rendering, gpu, image
D2dlib
A .NET library for hardware-accelerated, high performance, immediate mode rendering via Direct2D.
Stars: ✭ 84 (-50.59%)
Mutual labels:  rendering, gpu, library
Creepminer
Burstcoin C++ CPU and GPU Miner
Stars: ✭ 169 (-0.59%)
Mutual labels:  gpu, cpu
Sod
An Embedded Computer Vision & Machine Learning Library (CPU Optimized & IoT Capable)
Stars: ✭ 1,460 (+758.82%)
Mutual labels:  cpu, library
Impala
An imperative and functional programming language
Stars: ✭ 118 (-30.59%)
Mutual labels:  gpu, cpu
Mpr
Reference implementation for "Massively Parallel Rendering of Complex Closed-Form Implicit Surfaces" (SIGGRAPH 2020)
Stars: ✭ 84 (-50.59%)
Mutual labels:  rendering, gpu
Pdfviewpager
Android widget that can render PDF documents stored on SD card, linked as assets, or downloaded from a remote URL.
Stars: ✭ 1,508 (+787.06%)
Mutual labels:  rendering, library
Thorin
The Higher-Order Intermediate Representation
Stars: ✭ 116 (-31.76%)
Mutual labels:  gpu, cpu
Vulkan2drenderer
Easy to use 2D rendering engine using Vulkan API as backend.
Stars: ✭ 60 (-64.71%)
Mutual labels:  rendering, library
Touch Bar Istats
Show CPU/GPU/MEM temperature on Touch Bar with BetterTouchTool!
Stars: ✭ 141 (-17.06%)
Mutual labels:  gpu, cpu
Easydeviceinfo
📱 [Android Library] Get device information in a super easy way.
Stars: ✭ 1,698 (+898.82%)
Mutual labels:  cpu, library
Remotery
Single C file, Realtime CPU/GPU Profiler with Remote Web Viewer
Stars: ✭ 1,908 (+1022.35%)
Mutual labels:  gpu, cpu
Aardvark.rendering
The dependency-aware, high-performance aardvark rendering engine. This repo is part of aardvark - an open-source platform for visual computing, real-time graphics and visualization.
Stars: ✭ 79 (-53.53%)
Mutual labels:  rendering, gpu
Phenomenon
⚡️ A fast 2kB low-level WebGL API.
Stars: ✭ 1,551 (+812.35%)
Mutual labels:  rendering, gpu
Nplusminer
NPlusMiner + GUI | NVIDIA/AMD/CPU miner | AI | Autoupdate | MultiRig remote management
Stars: ✭ 75 (-55.88%)
Mutual labels:  gpu, cpu
Vrt
🔅 Ray tracing library for Vulkan API (indev)
Stars: ✭ 111 (-34.71%)
Mutual labels:  rendering, library
Isobmff
C++ Library for ISO/IEC 14496-12 - ISO Base Media File Format (QuickTime, MPEG-4, HEIF, etc)
Stars: ✭ 157 (-7.65%)
Mutual labels:  library, image
Ncnn Android Styletransfer
The style transfer android example
Stars: ✭ 54 (-68.24%)
Mutual labels:  gpu, cpu
Silicompressor
A powerful, flexible and easy to use Video and Image compression library for Android.
Stars: ✭ 1,081 (+535.88%)
Mutual labels:  library, image
Onemkl
oneAPI Math Kernel Library (oneMKL) Interfaces
Stars: ✭ 122 (-28.24%)
Mutual labels:  gpu, cpu

About

MediaWatemark is an open source GPU/CPU-based iOS watermark library for overlays adding to images or video content. It has simple interface and straightforward functionality.

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 overlaying views and texts over the videos or other images.

Light Code

MediaWatemark consists of light code and makes it easy to overlay 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.

Installation

CocoaPods

MediaWatermark is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "MediaWatermark"

Carthage

To integrate MediaWatermark into your Xcode project using Carthage, specify it in your Cartfile:

github "rubygarage/media-watermark" ~> 0.4

Run carthage update to build the framework and drag the built MediaWatermark.framework into your Xcode project.

Requirements

iOS: 9.0+
Swift: 5.0
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.

if let item = MediaItem(url: url) {
    let logoImage = UIImage(named: "rglogo")
            
    let firstElement = MediaElement(image: logoImage!)
    firstElement.frame = CGRect(x: 0, y: 0, width: logoImage!.size.width, height: logoImage!.size.height)
            
    let secondElement = MediaElement(image: logoImage!)
    secondElement.frame = CGRect(x: 150, y: 150, 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
    	// handle result            
    }
}

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:

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:

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()
    }
}

Image processing by Metal

MediaWatermark provides five filters for images:

  • Color filter
  • Sepia
  • Blur
  • Sobel
  • Threshold

To add filter over image:

let item = MediaItem(image: image)

let colorFilter = ColorFilter()
colorFilter.r = 1
colorFilter.g = 1
colorFilter.b = 0
        
item.applyFilter(mediaFilter: colorFilter)
        
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 secondElement = MediaElement(image: logoImage!)
secondElement.frame = CGRect(x: 100, y: 100, 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
}

Please note that filters are currently used for image assets only.

Author

Sergey Afanasiev

Getting Help

[email protected]

License

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


RubyGarage Logo

RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. Check out our portfolio for even more exciting works!

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].