Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/littlstar/color-extractor
https://github.com/littlstar/color-extractor
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/littlstar/color-extractor
- Owner: littlstar
- License: mit
- Created: 2016-01-28T18:36:22.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-29T19:12:28.000Z (almost 9 years ago)
- Last Synced: 2023-05-29T11:01:18.064Z (over 1 year ago)
- Language: C#
- Size: 4.88 KB
- Stars: 0
- Watchers: 10
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# color-extractor
Simple utility for Unity3D for finding the average color of a texture.
# Usage
Import the namespace:
``` csharp
using Littlstar.Utility;
```Getting the average color:
``` csharp
Color averageColor = TextureColorExtractor.GetAverageColor (myTexture);
```You can also get the average colors from a rectangular section of a texture:
``` csharp
Rect leftSideRect = new Rect(0f, 0f, myTexture.width / 2f, myTexture.height / 2f);
Color averageRectColor = TextureColorExtractor.GetAverageColorFromRect (myTexture, leftSideRect);
```This gets the average color of the left half of the provided texture. You can pass either a Texture, a Texture2D, or just an array of Color objects to both the GetAverageColor and GetAverageColorFromRect methods.
# License
MIT