diff --git a/AvatarOnBack/AvatarOnBack.csproj b/AvatarOnBack/AvatarOnBack.csproj
new file mode 100644
index 0000000..409c7f0
--- /dev/null
+++ b/AvatarOnBack/AvatarOnBack.csproj
@@ -0,0 +1,19 @@
+
+
+
+ Exe
+ netcoreapp1.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/AvatarOnBack/Avatars/astronaut_128.png b/AvatarOnBack/Avatars/astronaut_128.png
new file mode 100644
index 0000000..f09f268
Binary files /dev/null and b/AvatarOnBack/Avatars/astronaut_128.png differ
diff --git a/AvatarOnBack/Avatars/contractor_128.png b/AvatarOnBack/Avatars/contractor_128.png
new file mode 100644
index 0000000..e7870c7
Binary files /dev/null and b/AvatarOnBack/Avatars/contractor_128.png differ
diff --git a/AvatarOnBack/Avatars/doctor_128.png b/AvatarOnBack/Avatars/doctor_128.png
new file mode 100644
index 0000000..0762e08
Binary files /dev/null and b/AvatarOnBack/Avatars/doctor_128.png differ
diff --git a/AvatarOnBack/Backgrounds/back1.png b/AvatarOnBack/Backgrounds/back1.png
new file mode 100644
index 0000000..47648e1
Binary files /dev/null and b/AvatarOnBack/Backgrounds/back1.png differ
diff --git a/AvatarOnBack/Backgrounds/back2.jpg b/AvatarOnBack/Backgrounds/back2.jpg
new file mode 100644
index 0000000..41dc913
Binary files /dev/null and b/AvatarOnBack/Backgrounds/back2.jpg differ
diff --git a/AvatarOnBack/Program.cs b/AvatarOnBack/Program.cs
new file mode 100644
index 0000000..4a4bba1
--- /dev/null
+++ b/AvatarOnBack/Program.cs
@@ -0,0 +1,132 @@
+using ImageSharp;
+using ImageSharp.Drawing.Brushes;
+using SixLabors.Fonts;
+using System;
+using System.IO;
+
+namespace AvatarOnBack
+{
+ class Program
+ {
+ private static FontCollection fontCollection;
+ private static Font iconFont;
+ private static Font textFont;
+ private static Font titleFont;
+
+ static void Main(string[] args)
+ {
+ fontCollection = new FontCollection();
+ iconFont = fontCollection.Install("fonts/fontawesome-webfont.ttf");
+ titleFont = fontCollection.Install("fonts/Lato-Bold.ttf");
+ textFont = fontCollection.Install("fonts/Lato-Regular.ttf");
+
+ var avatars = Directory.EnumerateFiles("Avatars");
+ var backgrounds = Directory.EnumerateFiles("Backgrounds");
+ Directory.CreateDirectory("output");
+
+ foreach (var format in new[] { "png", "jpg" })
+ {
+ int counter = 0;
+ foreach (var a in avatars)
+ {
+ foreach (var b in backgrounds)
+ {
+ counter++;
+
+ GenerateImage(a, b, "\uf006", "Serenity", 2, 142, 900004, $"output/result-{counter}.{format}");
+ }
+ }
+ }
+ }
+
+
+ private static void GenerateImage(string avatarUrl, string backgroundUrl, string icon, string name, int rank, int level, int ep, string outputPath)
+ {
+ using (var output = new Image(400, 222))
+ {
+ DrawBackground(backgroundUrl, output);
+
+ DrawStats(rank, level, ep, output);
+
+ DrawTitle(icon, name, output);
+
+ DrawAvatar(avatarUrl, output);
+
+ output.Save(outputPath);
+ } // dispose of output to help save memory
+
+ }
+
+ private static void DrawBackground(string backgroundUrl, Image output)
+ {
+ using (Image background = Image.Load(backgroundUrl)) // 400x222
+ {
+ background.Resize(new ImageSharp.Processing.ResizeOptions
+ {
+ Mode = ImageSharp.Processing.ResizeMode.Crop,
+ Size = new ImageSharp.Size(output.Width, output.Height)
+ });
+
+ //draw on the background
+ output.DrawImage(background, 1, new ImageSharp.Size(400, 222), new Point(0, 0));
+ } // once draw it can be disposed as its no longer needed in memory
+ }
+
+ private static void DrawAvatar(string avatarUrl, Image output)
+ {
+ var avatarPosition = new Rectangle(42, 125, 57, 57);
+ var avatarPadding = 1;
+ // avatar background
+ output.Fill(Rgba32.Gainsboro, new Rectangle(avatarPosition.X - avatarPadding, avatarPosition.Y - avatarPadding, avatarPosition.Width + (avatarPadding * 2), avatarPosition.Height + (avatarPadding * 2)));
+
+ using (var avatar = Image.Load(avatarUrl)) // 57x57
+ {
+ avatar.Resize(new ImageSharp.Processing.ResizeOptions
+ {
+ Mode = ImageSharp.Processing.ResizeMode.Crop,
+ Size = avatarPosition.Size
+ });
+
+ output.DrawImage(avatar, 1, avatarPosition.Size, avatarPosition.Location);
+ }
+ }
+
+ private static void DrawStats(int rank, int level, int ep, Image output)
+ {
+ Rgba32 statsColor = Rgba32.Gainsboro;
+ statsColor.A = 210;
+ // stats background
+ output.Fill(statsColor, new Rectangle(56, 174, 345, 48));
+
+ // measure each string and split the margin between them??
+ var font = new Font(textFont, 20, FontStyle.Regular);
+
+ // rank
+ output.DrawText($"Rank: {rank}", font, Rgba32.Gray, new System.Numerics.Vector2(108, 191), new ImageSharp.Drawing.TextGraphicsOptions
+ {
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Left
+ });
+ output.DrawText($"Level: {level}", font, Rgba32.Gray, new System.Numerics.Vector2(235, 191), new ImageSharp.Drawing.TextGraphicsOptions
+ {
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Center
+ });
+ output.DrawText($"EP: {ep}", font, Rgba32.Gray, new System.Numerics.Vector2(394, 191), new ImageSharp.Drawing.TextGraphicsOptions
+ {
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Right
+ });
+ }
+
+ private static void DrawTitle(string icon, string name, Image output)
+ {
+ var titleColor = Rgba32.DimGray;
+ titleColor.A = 220;
+ // title background
+ output.Fill(Rgba32.DimGray, new Rectangle(100, 134, 300, 40));
+ output.DrawText(icon, new Font(iconFont, 22), Rgba32.White, new System.Numerics.Vector2(114, 142));
+ output.DrawText(name, new Font(titleFont, 32, FontStyle.Bold), Rgba32.White, new System.Numerics.Vector2(140, 128));
+ }
+ }
+}
\ No newline at end of file
diff --git a/AvatarOnBack/fonts/Lato-Bold.ttf b/AvatarOnBack/fonts/Lato-Bold.ttf
new file mode 100644
index 0000000..7434369
Binary files /dev/null and b/AvatarOnBack/fonts/Lato-Bold.ttf differ
diff --git a/AvatarOnBack/fonts/Lato-Regular.ttf b/AvatarOnBack/fonts/Lato-Regular.ttf
new file mode 100644
index 0000000..04ea8ef
Binary files /dev/null and b/AvatarOnBack/fonts/Lato-Regular.ttf differ
diff --git a/AvatarOnBack/fonts/fontawesome-webfont.ttf b/AvatarOnBack/fonts/fontawesome-webfont.ttf
new file mode 100644
index 0000000..35acda2
Binary files /dev/null and b/AvatarOnBack/fonts/fontawesome-webfont.ttf differ
diff --git a/AvatarOnBack/output/result-1.jpg b/AvatarOnBack/output/result-1.jpg
new file mode 100644
index 0000000..08c3942
Binary files /dev/null and b/AvatarOnBack/output/result-1.jpg differ
diff --git a/AvatarOnBack/output/result-1.png b/AvatarOnBack/output/result-1.png
new file mode 100644
index 0000000..cfac3cf
Binary files /dev/null and b/AvatarOnBack/output/result-1.png differ
diff --git a/AvatarOnBack/output/result-2.jpg b/AvatarOnBack/output/result-2.jpg
new file mode 100644
index 0000000..0d0a2f4
Binary files /dev/null and b/AvatarOnBack/output/result-2.jpg differ
diff --git a/AvatarOnBack/output/result-2.png b/AvatarOnBack/output/result-2.png
new file mode 100644
index 0000000..376e55e
Binary files /dev/null and b/AvatarOnBack/output/result-2.png differ
diff --git a/AvatarOnBack/output/result-3.jpg b/AvatarOnBack/output/result-3.jpg
new file mode 100644
index 0000000..c54e4e2
Binary files /dev/null and b/AvatarOnBack/output/result-3.jpg differ
diff --git a/AvatarOnBack/output/result-3.png b/AvatarOnBack/output/result-3.png
new file mode 100644
index 0000000..d5ccd40
Binary files /dev/null and b/AvatarOnBack/output/result-3.png differ
diff --git a/AvatarOnBack/output/result-4.jpg b/AvatarOnBack/output/result-4.jpg
new file mode 100644
index 0000000..0f952a1
Binary files /dev/null and b/AvatarOnBack/output/result-4.jpg differ
diff --git a/AvatarOnBack/output/result-4.png b/AvatarOnBack/output/result-4.png
new file mode 100644
index 0000000..23f9d22
Binary files /dev/null and b/AvatarOnBack/output/result-4.png differ
diff --git a/AvatarOnBack/output/result-5.jpg b/AvatarOnBack/output/result-5.jpg
new file mode 100644
index 0000000..776eeff
Binary files /dev/null and b/AvatarOnBack/output/result-5.jpg differ
diff --git a/AvatarOnBack/output/result-5.png b/AvatarOnBack/output/result-5.png
new file mode 100644
index 0000000..4bbd020
Binary files /dev/null and b/AvatarOnBack/output/result-5.png differ
diff --git a/AvatarOnBack/output/result-6.jpg b/AvatarOnBack/output/result-6.jpg
new file mode 100644
index 0000000..2ae02d6
Binary files /dev/null and b/AvatarOnBack/output/result-6.jpg differ
diff --git a/AvatarOnBack/output/result-6.png b/AvatarOnBack/output/result-6.png
new file mode 100644
index 0000000..ac7b9d5
Binary files /dev/null and b/AvatarOnBack/output/result-6.png differ
diff --git a/Demos.sln b/Demos.sln
index 07c9a13..dea367b 100644
--- a/Demos.sln
+++ b/Demos.sln
@@ -1,12 +1,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.26403.7
+VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WaterMarkSample", "WaterMarkSample\WaterMarkSample.csproj", "{06858879-8323-4F32-8260-EFA17EC1DD4F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WordArt", "WordArt\WordArt.csproj", "{A5E91B24-8395-4482-A1A9-087AC9EF5492}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvatarOnBack", "AvatarOnBack\AvatarOnBack.csproj", "{3475CDE1-D623-4563-A592-F9A0A61FE28F}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{A5E91B24-8395-4482-A1A9-087AC9EF5492}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5E91B24-8395-4482-A1A9-087AC9EF5492}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5E91B24-8395-4482-A1A9-087AC9EF5492}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3475CDE1-D623-4563-A592-F9A0A61FE28F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3475CDE1-D623-4563-A592-F9A0A61FE28F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3475CDE1-D623-4563-A592-F9A0A61FE28F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3475CDE1-D623-4563-A592-F9A0A61FE28F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE