-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
365 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
/EncodeAndSign/bin/Debug | ||
/EncodeAndSign/obj/Debug | ||
/EncodeAndSign/packages | ||
/Flipnote Tools Desktop |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace EncodeAndSign | ||
{ | ||
[JsonObject] | ||
public class Config | ||
{ | ||
public int DitheringMode { get; set; } | ||
public bool Accurate { get; set; } | ||
public bool Split { get; set; } | ||
|
||
public Config() { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
using SixLabors.ImageSharp; | ||
using SixLabors.ImageSharp.Processing; | ||
using SixLabors.ImageSharp.Processing.Processors.Dithering; | ||
using System.Collections.Generic; | ||
using System.Drawing; | ||
|
||
namespace EncodeAndSign.Encoder | ||
{ | ||
public class ImageEncoder | ||
{ | ||
public ImageEncoder() | ||
{ | ||
|
||
} | ||
|
||
public void DoRinDithering(string[] filenames, int type) | ||
{ | ||
List<Bitmap> bitmaps = new List<Bitmap>(); | ||
IDither DitheringType = null; | ||
switch (type) | ||
{ | ||
case 0: | ||
DitheringType = KnownDitherings.Bayer8x8; | ||
break; | ||
case 1: | ||
DitheringType = KnownDitherings.Bayer4x4; | ||
break; | ||
case 2: | ||
DitheringType = KnownDitherings.Bayer2x2; | ||
break; | ||
case 3: | ||
DitheringType = KnownDitherings.FloydSteinberg; | ||
break; | ||
case 4: | ||
DitheringType = KnownDitherings.Atkinson; | ||
break; | ||
case 5: | ||
DitheringType = KnownDitherings.Burks; | ||
break; | ||
case 6: | ||
DitheringType = KnownDitherings.JarvisJudiceNinke; | ||
break; | ||
case 7: | ||
DitheringType = KnownDitherings.Sierra3; | ||
break; | ||
case 8: | ||
DitheringType = KnownDitherings.StevensonArce; | ||
break; | ||
case 9: | ||
DitheringType = KnownDitherings.Sierra2; | ||
break; | ||
case 10: | ||
DitheringType = KnownDitherings.Sierra3; | ||
break; | ||
case 11: | ||
DitheringType = KnownDitherings.SierraLite; | ||
break; | ||
case 12: | ||
DitheringType = KnownDitherings.Stucki; | ||
break; | ||
case 13: | ||
DitheringType = KnownDitherings.Ordered3x3; | ||
break; | ||
default: | ||
//this one is my favorite :) | ||
DitheringType = KnownDitherings.Bayer8x8; | ||
break; | ||
} | ||
for (int i = 0; i < filenames.Length; i++) | ||
{ | ||
using (SixLabors.ImageSharp.Image image = SixLabors.ImageSharp.Image.Load(filenames[i])) | ||
{ | ||
image.Mutate(x => | ||
{ | ||
x.BinaryDither(DitheringType); | ||
}); | ||
image.SaveAsPng($"frames/frame_{i}.png"); | ||
image.Dispose(); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.