Skip to content

Commit

Permalink
Merge branch 'main' into documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
seujorgenochurras authored Feb 13, 2024
2 parents b7ba27c + dfeee89 commit ecf1226
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
image-to-ascii is a java image to ascii art parser, as the name implies, it generates an ASCII art from any image.<br>
It is highly configurable but at the same time easy to use.


## Results

<div>
Expand All @@ -19,7 +20,6 @@ It is highly configurable but at the same time easy to use.
<br>

# Download

Gradle:

```gradle
Expand All @@ -44,27 +44,26 @@ Maven:

[JPM](https://github.com/seujorgenochurras/Jhey-Package-Manager):

⚠️ NOT RECOMMENDED ⚠️ [JPM](https://github.com/seujorgenochurras/Jhey-Package-Manager) has a hole lots of bugs
and it'll probably cause you to have a massive headache.<br>
``jpm -i=io.github.seujorgenochurras.image-to-ascii``

⚠️ NOT RECOMMENDED ⚠️ [JPM](https://github.com/seujorgenochurras/Jhey-Package-Manager) has a whole lots of bugs
and it'll probably give you a massive headache.<br>
This is here because I worked hard (and badly) on it,
if you liked the idea please let me know.
if you liked the idea please let me know somehow.

`jpm -i=io.github.seujorgenochurras.image-to-ascii`

# Usage

Since the parser is highly configurabe it might be really annoying to use it.
Since the parser is highly configurabe it might be really annoying to use.
So if you are in a hurry or you just don't want to read the code you can use the `DefaultParserConfig`.

```java
String imagePath = "smth/somewhere/yourImageFilePath";

String imagePath = "smth/somewhere/yourImageFilePath";

String imageAsciiArt = DefaultAsciifier.toAscii(imagePath, height, width, withAnsiColor);
String imageAsciiArt = DefaultAsciifier.toAscii(imagePath, height, width, withAnsiColor);

FileWriter fileWriter = new FileWriter("myAsciiArt.txt");
fileWriter.write(imageAsciiArt);
fileWriter.flush();
FileWriter fileWriter = new FileWriter("myAsciiArt.txt");
fileWriter.write(imageAsciiArt);
fileWriter.flush();

```
<br>
Expand All @@ -78,14 +77,14 @@ If you want to configure more stuff such as the core algorithms, you can do it w
String[] symbols = {" ", ".", "-", "I", "W", "@"};

ParserConfig parserConfig = ParserBuilder.startBuild()
.parserAlgorithm(Algorithms.HUMAN_EYE_ALGORITHM)
.scaled()
.height(30)
.width(80)
.getScale()
.symbols(symbols)
.withColor(new AnsiColorAlgorithm())
.build();
.parserAlgorithm(Algorithms.HUMAN_EYE_ALGORITHM)
.scaled()
.height(30)
.width(80)
.getScale()
.symbols(symbols)
.withColor(new AnsiColorAlgorithm())
.build();

String asciiArt = AsciiParser.parse(imagePath, parserConfig);

Expand All @@ -101,8 +100,8 @@ If you want to configure more stuff such as the core algorithms, you can do it w

```java

String[] unorderedSymbols = StringUtils.getUTFChars(32, 132);
String[] symbols = BestSymbolPatternFinder.findBestPattern(totalSymbols, unorderedSymbols).toArray();
String[] unorderedSymbols = StringUtils.getUTFChars(32, 132);
String[] symbols = BestSymbolPatternFinder.findBestPattern(totalSymbols, unorderedSymbols).toArray();

```

Expand All @@ -111,4 +110,3 @@ If you want to configure more stuff such as the core algorithms, you can do it w
More specifically ANSI colors, if you have no idea what ANSI is,
it is basically a standard on most of terminals that allows you to make some pretty awesome stuff, like playing videos with characters on your terminal or even colorize them.<br>
for now there are only 2 colored algorithms, the normal ANSI and the ANSI with tones

0 comments on commit ecf1226

Please sign in to comment.