Git Product home page Git Product logo

mosaic's Introduction

Mosaic

This currently only operates on mapping individual pixels, I am working on writing this such that it maps multiple pixels to a single palette item, which is a work in progress.

Let's say you have a collection of images, and you want to put them together in a way that resembles any image you'd like. What this program does, is take as input, a folder of images (our palette), and an input image (what we are trying to recreate).

This basically goes through every item (image) in the palette and finds the average color for each item in the palette. After this process, we can then go through every pixel in our image, and figure out which item from our palette most resembles our pixel. Using this information, we can construct the mosaic by taking the pixels from items in our palette and writing them to a new image.

This can work with any set of images, it doesn't have to be emojis.

To compile:

cargo build --release

To use:

For prompts:

  • ./mosaic

For terminal argument input:

  • ./mosaic --help

command line args: ./mosaic -f Landscape-Color.png -p emoji -fs 256 -ps 16 -v 64.0

  • Specify file.png scaled to a max size of 256, using the palette "emoji" scaled to 16x16, with a "variance" of 1/64[^1][^2]

Pass in the extension for the file name!

How Do You Use Other Images?

1 Find a collection of images

2 Put the images into a named folder

  • In this repo, packaged for convenience, the mentioned collection is named emojis/

3 Put named folder under palettes/

mosaic's People

Contributors

adwilk avatar ahhhh6980 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mosaic's Issues

README example isn't working

Hey,

I was trying your cool library but I haven't been able to run it. I am using all the defaults but it can't find an image and it doesn't say which one.

➜  Mosaic git:(main) ✗ ./mosaic -f Landscape-Color.png -p emoji

Enter the number of threads to use
Only choose more than a couple for very large fsize values
(like fsize over 512 w/ psize over 32)
Choose a value in the range [1:7] (default: 3)

3

Enter a palette size
Choose a value in the range [4:127] (default: 16)

16

Enter a image size
Choose a value in the range [16:268435454] (default: 64)

64

Enter a qfactor
Choose a value in the range [4:127] (default: 64)

64

Please enter the output name
aaa.png
Processing: Landscape-Color.png, with palette: emoji, at img size: 64, and palette size: 16
Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.