Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
eNeRGy164 committed Feb 5, 2021
1 parent ef0d0d3 commit 8d61899
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
25 changes: 25 additions & 0 deletions Pixcel.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30804.86
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Pixcel", "Pixcel\Pixcel.csproj", "{5C53F119-B7F4-4224-A90F-225D66BC5D12}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5C53F119-B7F4-4224-A90F-225D66BC5D12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5C53F119-B7F4-4224-A90F-225D66BC5D12}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5C53F119-B7F4-4224-A90F-225D66BC5D12}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5C53F119-B7F4-4224-A90F-225D66BC5D12}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6E63A6E5-8FB0-4A9E-9975-D0F472EB1257}
EndGlobalSection
EndGlobal
20 changes: 20 additions & 0 deletions Pixcel/Pixcel.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>
<Authors>Michaël Hompus</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
</PropertyGroup>

<PropertyGroup>
<PlatformTarget>x64</PlatformTarget>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EPPlus" Version="5.5.3" />
</ItemGroup>

</Project>
28 changes: 28 additions & 0 deletions Pixcel/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using OfficeOpenXml;
using OfficeOpenXml.Style;
using System.Drawing;
using System.IO;

var source = args[0];

var bitmap = new Bitmap(64, 64);
using var graphics = Graphics.FromImage(bitmap);
graphics.DrawImage(new Bitmap(source), 0, 0, 64, 64);

ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using var package = new ExcelPackage(new FileInfo(source.Replace(Path.GetExtension(source), ".xlsx")));
var worksheet = package.Workbook.Worksheets["Pixcel"] ?? package.Workbook.Worksheets.Add("Pixcel");

for (int y = 1; y <= bitmap.Width; y++)
{
worksheet.Column(y).Width = 5;

for (int x = 1; x <= bitmap.Height; x++)
{
worksheet.Row(x).Height = 25;
worksheet.Cells[x, y].Style.Fill.PatternType = ExcelFillStyle.Solid;
worksheet.Cells[x, y].Style.Fill.BackgroundColor.SetColor(bitmap.GetPixel(y - 1, x - 1));
}
}

package.Save();
8 changes: 8 additions & 0 deletions Pixcel/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"profiles": {
"Pixcel": {
"commandName": "Project",
"commandLineArgs": "\"C:\\Users\\micha\\Pictures\\Info Support\\Profile1000x1000.jpg\""
}
}
}

0 comments on commit 8d61899

Please sign in to comment.