generate-avatar's People
generate-avatar's Issues
New algorithm?
While investigating #3, I found out about something: GenerateAvatar does not play well with real-life images.
Here's an example:
Input | Output |
---|---|
![]() |
![]() |
That looks no better than pseudo-random noise to me.
The kinds of images I built it for do a lot better:
Input | Output |
---|---|
![]() |
![]() |
Picture from Noto Color Emoji via Emojipedia
That said, I think it's time to come up with a new algorithm. A v2.
Fix "method_complexity" issue in src/me/barend/generateavatar/Main.java
Method setColor
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Test ticket from Code Climate
Fix "com.puppycrawl.tools.checkstyle.checks.javadoc.SummaryJavadocCheck" issue in src/me/barend/generateavatar/Main.java
First sentence of Javadoc is missing an ending period.
Add proper error handling
Image … is a fallback image that requires a JDK for execution
When I try to build a native image, I get the following output:
bash-4.2# javac src/me/barend/generateavatar/*
bash-4.2# native-image -cp src me.barend.generateavatar.Main
Build on Server(pid: 267, port: 35691)*
[me.barend.generateavatar.main:267] classlist: 3,589.99 ms
[me.barend.generateavatar.main:267] (cap): 767.69 ms
[me.barend.generateavatar.main:267] setup: 2,277.49 ms
[me.barend.generateavatar.main:267] (typeflow): 7,316.51 ms
[me.barend.generateavatar.main:267] (objects): 4,605.89 ms
[me.barend.generateavatar.main:267] (features): 334.42 ms
[me.barend.generateavatar.main:267] analysis: 12,491.46 ms
[me.barend.generateavatar.main:267] (clinit): 223.12 ms
[me.barend.generateavatar.main:267] universe: 667.88 ms
Warning: Reflection method java.lang.Class.getField invoked at me.barend.generateavatar.Main.getColor(Main.java:98)
Warning: Reflection method java.lang.Class.getFields invoked at me.barend.generateavatar.Main.getColorFields(Main.java:111)
Warning: Aborting stand-alone image build due to reflection use without configuration.
Warning: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Build on Server(pid: 267, port: 35691)
[me.barend.generateavatar.main:267] classlist: 822.22 ms
[me.barend.generateavatar.main:267] (cap): 518.02 ms
[me.barend.generateavatar.main:267] setup: 897.54 ms
[me.barend.generateavatar.main:267] (typeflow): 2,544.12 ms
[me.barend.generateavatar.main:267] (objects): 2,429.18 ms
[me.barend.generateavatar.main:267] (features): 119.63 ms
[me.barend.generateavatar.main:267] analysis: 5,192.04 ms
[me.barend.generateavatar.main:267] (clinit): 77.66 ms
[me.barend.generateavatar.main:267] universe: 254.91 ms
[me.barend.generateavatar.main:267] (parse): 529.55 ms
[me.barend.generateavatar.main:267] (inline): 1,166.62 ms
[me.barend.generateavatar.main:267] (compile): 5,174.05 ms
[me.barend.generateavatar.main:267] compile: 7,225.65 ms
[me.barend.generateavatar.main:267] image: 460.21 ms
[me.barend.generateavatar.main:267] write: 182.44 ms
[me.barend.generateavatar.main:267] [total]: 15,179.05 ms
Warning: Image 'me.barend.generateavatar.main' is a fallback image that requires a JDK for execution (use --no-fallback to suppress fallback image generation).
It is possible to use reflection, though: https://github.com/oracle/graal/blob/master/substratevm/REFLECTION.md
Don't hardcode image paths
Don’t open window while the program is running
The line responsible for the opening of this window is:
If I comment that out (and the gfx.drawImage(…)
line below it), no window is opened, and the code runs a lot faster. However, it does not produce the desired result, and returns an image with just the backgroundColor
.
Even more curiously, if the transparentToOpaque
method is commented out altogether (so it goes straight from readImage
to imageToGreyscale
), strange streaks are visible all over the background, giving a somewhat cool (but ultimately undesirable) effect.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.