Anime4KSharp is a .Net Core library that implements bloc97's Anime4K Algorithm version 0.9 and 1.0 RC2.
The Algorithm is executed on the CPU, but utilizing all CPU Cores that are available.
This yields to a conversion time of "only" 4432 ms when upscaling from 1080p to 2160p. This time could possibly reduced with further optimization.
Images are processed in four phases that are executed on a pixel- per- pixel basis. Each phase takes a input image and renders it to a output image.
This makes it easy to port the algorithm (back) to GLSL fragment shaders.
Call Anime4KCli without arguments to show the help page.
Basic example of upscaling a image 2x:
Anime4KCli -input "./test.png" -output "./test-upscaled.png" -scale 2
--OR--
Anime4KCli -i "./test.png" -o "./test-upscaled.png" -s 2
To use the Library, you have to add ImageSharp to your dependencies.
//Load the Imput Image in RGBA32 format
Image<Rgba32> input = Image.Load<Rgba32>("your/input/image.png");
//scale up 2x using anime4k
Image<Rgba32> output = Anime4K09.ScaleAnime4K(input, 2);
//just run Anime4K without upscaling
Image<Rgba32> output = Anime4K09.PushAnime4K(input);
//save finished image
output.Save("your/output/image.png");
As bloc97 described in his pseudo-preprint, the Anime4K algorithm is actually quite simple.
I, however, will only give a brief overview of the algorithm. If you want to read more, I highly suggest bloc97's preprint.
Since I now have two Versions of the Anime4K algorithm, I also need to pages that explain how it works.
You can find those pages here:
I wrote this port of Anime4K to get a deeper understanding of the Algorithm.
My personal end goal was to understand Anime4K and the mechanics behind it enough to port it from the reference implementation (which is written in "mpv- syntax" GLSL) to GLSL ES Fragment Shaders.
You can see the end result in my Video Player App YAVP where I re- implemented Anime4K 0.9 in GLSL ES (running on a mobile GPU that constantly almost dies from stress :P).
- bloc97/Anime4K
- yeataro/TD-Anime4K
- keijiro/UnityAnime4K
- andraantariksa/Anime4K-rs
- k4yt3x/video2x
- TianZerL/Anime4KPython
- TianZerL/Anime4KCPP
- TianZerL/Anime4KGo
- net2cn/Anime4KSharp*
*This is another Implementation of Anime4K 0.9 in C#, however, net2cn uses C#'s builtin Bitmap class. Still, both mine and net2cn's implementation share many similarities since they are based on the same algorithm.
All art assets used are for demonstration and educational purposes. All rights are reserved to their original owners. If you (as a person or a company) own the art and do not wish it to be associated with this project, please contact me (eg by opening a Github issue) and I will gladly take it down.
Images used for Demonstration are from Cells At Work.
This repository is created only for learning purposes.
The contents of this repository are provided "as is" and are offered without any warranties, but with the hope that they will prove useful to someone. I will not be responsible for any damage caused.
- The Images used to demonstrate the Algorithm are used for demonstational and educational purposes. If you (as the owner) are not ok with this, please open a Github issue and I will take the Images down.
- You can use the contents of this repository to learn about the Anime4K algorithm.
- However, if you (somehow) blow your PC up while using this code, you're on your own.