ColorAverage 1.0.0
dotnet add package ColorAverage --version 1.0.0
NuGet\Install-Package ColorAverage -Version 1.0.0
<PackageReference Include="ColorAverage" Version="1.0.0" />
<PackageVersion Include="ColorAverage" Version="1.0.0" />
<PackageReference Include="ColorAverage" />
paket add ColorAverage --version 1.0.0
#r "nuget: ColorAverage, 1.0.0"
#:package ColorAverage@1.0.0
#addin nuget:?package=ColorAverage&version=1.0.0
#tool nuget:?package=ColorAverage&version=1.0.0
Ethereum NFT Color Averager (C#)
Overview
This C# program is designed to retrieve Ethereum-based Non-Fungible Tokens (NFTs) and calculate the average color of the images associated with these NFTs. It leverages the Ethereum blockchain and external image processing libraries to accomplish this task. The library is using Image Sharp for image analysis and Nethereum for Blockchain interaction via Infura.
IMPORTANT: An Infura API key is required. Infuras free API tier allows for 100,000 free requests a day.
Features
- Connects to the Ethereum blockchain to fetch NFTs using the Ethereum NFT standard (e.g., ERC-721 or ERC-1155).
- Downloads images associated with each NFT.
- Calculates the average color of the images.
- Provides options for specifying the NFT contract address, token IDs, and output format.
Requirements
Before running the program, ensure you have the following dependencies and prerequisites:
- .NET Core installed on your system.
- Access to an Ethereum node or a service like Infura to interact with the Ethereum blockchain.
- Any additional libraries or packages specified in the project's
csprojfile.
Usage
Instantiate the EthereumMetadataService
EthereumMetadataService ethereumMetadataService = new EthereumMetadataService("your infura API key");Get NFT Image
//the method takes the contract address and the token id as the parameter byte[] picture = ethereumMetadataService.GetNftPicture("contract address", 1);Optionally you also have the options to get the NFT picture url, metadata url or metadata
//the method takes the contract address and the token id as the parameter string nftPictureUrl = ethereumMetadataService.GetNftPictureUrl("contract address", 1); //the method takes the contract address and the token id as the parameter string nftMetadataUrl = ethereumMetadataService.GetNftMetadataUrl("contract address", 1); //the method takes the contract address and the token id as the parameter string metadata = ethereumMetadataService.GetNftMetadataString("contract address", 1);Instantiate the PixelAverageService
PixelAverageService pixelAverageService = new PixelAverageService();Call the GetTopPixelColor method
//the file is a byte[], the second argument is the amount of colors that is returned, the method returns the RGBA string[] topColors = pixelAverageService.GetTopPixelColor(file, 3);
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.0
- Nethereum.ABI (>= 4.16.0)
- Nethereum.Accounts (>= 4.16.0)
- Nethereum.Contracts (>= 4.16.0)
- Nethereum.Hex (>= 4.16.0)
- Nethereum.Model (>= 4.16.0)
- Nethereum.Util (>= 4.16.0)
- Nethereum.Web3 (>= 4.16.0)
- SixLabors.ImageSharp (>= 3.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 249 | 10/10/2023 |