art42
I've recently discovered this awesome proyect:
https://art42.net/ #
I liked so much that I integrated into this blog.
Deterministic (random) image #
The url of the images are like this:
https://cdn.vcloud42.com/file/art42-cdn/cubism/seed_seed_0000089306.jpg
so obtaining an image is a matter of providing a number.
Because I want to use the same image for the same tag, first I create a random number by hashing a string:
function hashStringToInt(str, max = 293916) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = (hash << 5) - hash + str.charCodeAt(i);
hash = hash & hash;
}
return Math.round((max * Math.abs(hash)) / 2147483648) + 7;
}
And then create a url:
export function imageUrl(text: string) {
const id = hashStringToInt(text).toString().padStart(10, "0");
return `https://cdn.vcloud42.com/file/art42-cdn/cubism/seed_${id}.jpg`;
}
Resources #
https://gigazine.net/gsc_news/en/20200217-art42-infinite-stream-ai-art/
- https://news.ycombinator.com/item?id=22344254
- https://twitter.com/valentinvieriu
- https://github.com/valentinvieriu/stylegan2
- https://github.com/pbaylies/stylegan2 https://twitter.com/art42net
🖖