lego-image-converter


Namelego-image-converter JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/zl3311/lego_image_converter
Summaryminor update after formal release
upload_time2023-07-31 03:12:09
maintainer
docs_urlNone
authorZequn Li
requires_python
licenseMIT
keywords pypi lego_image_converter lego image 8bit art
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lego_image_converter
 A simple program that converts an image to a Lego-fied picture.

---

## Background
Here's how this simple package started. 
(Feel free to skip if you're in a hurry, but why would anyone trying to enjoy Lego and to kill time in a such hurry?)

Originally, I purchased [Lego Art Project 21226](https://www.lego.com/en-us/product/art-project-create-together-21226)
(now retired) as the Thanksgiving gift for myself back in 2022, but I didn't have the chance to 
put up the pieces, since recession is kind of suffocating many folks, including myself.

It is until mid 2023 that I finally have some room to breath, and I realize that I haven't opened this toy that 
has been sitting in the corner of my room 
for like 8 months or so. 
So I reckon it's probably a decent timing to bring some innocent joy back to my life. 

The main bummer is that Lego includes barely enough blocks only to build the 
images in their manuals 
(like blue blocks are the most common (660 pieces), but considering a 48x48=2304 canvas, it means you need colorful 
background otherwise you'll run out of some color blocks), and that is not enough if you want to do something fancy. 
I understand that Lego is for-profit company, and real hardcore Lego players spend tons of money 
on buying customized blocks themselves (and I'm not prodigal enough to be one of them). 
Still, I feel like Lego is not generous enough for such a brilliant idea on this Art Project product. 

Another issue is that there isn't a tool that automatically converts a random image into a prototype as if you were to 
build it in Lego, which means you might spend tons of time working on something that is undesirable, 
and we adults are short on time. This is the reason why I build this package. You're welcome, Lego Engineering team.

Don't get me wrong: I'm still a huge fan of Lego, 
and I hope this package can save Lego players and likely programmers as well some time prototyping their ideas.

## How to use
Please install the package using 

`pip install lego-image-converter`

You can check out some examples on [this Colab notebook](https://colab.research.google.com/drive/17k9ckWLznP_u6kH2rp3Ibujk6voFmn-X#scrollTo=nS3hGf1_kpy4). 

**Disclaimer: I do not own any right of the pictures in examples, 
and they are not intended for profit either. If you're the owner of the pictures
and would like me to remove it, feel free to reach out, and I'm happy to remove it for you.** 

I screenshot the pictures from the Internet, namely
- Tsunami from [here](https://www.zazzle.com/the_great_wave_off_kanagawa_8_bit_pixel_art_plaque-200560049736055877).
- Cheetah's logo from [here](https://is3-ssl.mzstatic.com/image/thumb/Purple125/v4/73/dd/09/73dd0955-fabe-9a96-cc09-641dbf9b9141/source/512x512bb.jpg).
- Twitter's logo from [here](https://commons.wikimedia.org/wiki/File:Logo_of_Twitter.svg).
- Doge's logo from [here](https://variety.com/2023/digital/news/elon-musk-twitter-logo-doge-dogecoin-meme-1235572343/).

## Notes

- The trimming procedure of this package is super dumb, because it's too tedious to do the CV stuff
  (like figure out the center of the picture, majorly and minorly adjust the anchoring point, etc.) 
 for such a mini package and I'm not a CV expert. 
My suggestion for you is to start your screenshot from the lower left corner, drag it until 
either the length or width dimension is desirable and leave extra buffer in the other dimension. 
The trimming algorithm can only handle this situation properly, so it is not intelligent at all.

- I was using a naive Euclidean distance on RGB channel for matching pixels and Lego colors, and it sucks. 
I found this [colormath](https://python-colormath.readthedocs.io/en/latest/) package useful in 
addressing the nonlinearities of human vision perception, and it performs decently well.

- I'm using `unlimited_blocks=True` for the sake of illustration.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zl3311/lego_image_converter",
    "name": "lego-image-converter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pypi,lego_image_converter,lego,image,8bit,art",
    "author": "Zequn Li",
    "author_email": "zequn1992@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d3/0e/7fdf31ed336abe4873a51ee11fd4a26f29e3ba935edd56b2e46be1a0ad97/lego_image_converter-0.1.2.tar.gz",
    "platform": null,
    "description": "# lego_image_converter\n A simple program that converts an image to a Lego-fied picture.\n\n---\n\n## Background\nHere's how this simple package started. \n(Feel free to skip if you're in a hurry, but why would anyone trying to enjoy Lego and to kill time in a such hurry?)\n\nOriginally, I purchased [Lego Art Project 21226](https://www.lego.com/en-us/product/art-project-create-together-21226)\n(now retired) as the Thanksgiving gift for myself back in 2022, but I didn't have the chance to \nput up the pieces, since recession is kind of suffocating many folks, including myself.\n\nIt is until mid 2023 that I finally have some room to breath, and I realize that I haven't opened this toy that \nhas been sitting in the corner of my room \nfor like 8 months or so. \nSo I reckon it's probably a decent timing to bring some innocent joy back to my life. \n\nThe main bummer is that Lego includes barely enough blocks only to build the \nimages in their manuals \n(like blue blocks are the most common (660 pieces), but considering a 48x48=2304 canvas, it means you need colorful \nbackground otherwise you'll run out of some color blocks), and that is not enough if you want to do something fancy. \nI understand that Lego is for-profit company, and real hardcore Lego players spend tons of money \non buying customized blocks themselves (and I'm not prodigal enough to be one of them). \nStill, I feel like Lego is not generous enough for such a brilliant idea on this Art Project product. \n\nAnother issue is that there isn't a tool that automatically converts a random image into a prototype as if you were to \nbuild it in Lego, which means you might spend tons of time working on something that is undesirable, \nand we adults are short on time. This is the reason why I build this package. You're welcome, Lego Engineering team.\n\nDon't get me wrong: I'm still a huge fan of Lego, \nand I hope this package can save Lego players and likely programmers as well some time prototyping their ideas.\n\n## How to use\nPlease install the package using \n\n`pip install lego-image-converter`\n\nYou can check out some examples on [this Colab notebook](https://colab.research.google.com/drive/17k9ckWLznP_u6kH2rp3Ibujk6voFmn-X#scrollTo=nS3hGf1_kpy4). \n\n**Disclaimer: I do not own any right of the pictures in examples, \nand they are not intended for profit either. If you're the owner of the pictures\nand would like me to remove it, feel free to reach out, and I'm happy to remove it for you.** \n\nI screenshot the pictures from the Internet, namely\n- Tsunami from [here](https://www.zazzle.com/the_great_wave_off_kanagawa_8_bit_pixel_art_plaque-200560049736055877).\n- Cheetah's logo from [here](https://is3-ssl.mzstatic.com/image/thumb/Purple125/v4/73/dd/09/73dd0955-fabe-9a96-cc09-641dbf9b9141/source/512x512bb.jpg).\n- Twitter's logo from [here](https://commons.wikimedia.org/wiki/File:Logo_of_Twitter.svg).\n- Doge's logo from [here](https://variety.com/2023/digital/news/elon-musk-twitter-logo-doge-dogecoin-meme-1235572343/).\n\n## Notes\n\n- The trimming procedure of this package is super dumb, because it's too tedious to do the CV stuff\n  (like figure out the center of the picture, majorly and minorly adjust the anchoring point, etc.) \n for such a mini package and I'm not a CV expert. \nMy suggestion for you is to start your screenshot from the lower left corner, drag it until \neither the length or width dimension is desirable and leave extra buffer in the other dimension. \nThe trimming algorithm can only handle this situation properly, so it is not intelligent at all.\n\n- I was using a naive Euclidean distance on RGB channel for matching pixels and Lego colors, and it sucks. \nI found this [colormath](https://python-colormath.readthedocs.io/en/latest/) package useful in \naddressing the nonlinearities of human vision perception, and it performs decently well.\n\n- I'm using `unlimited_blocks=True` for the sake of illustration.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "minor update after formal release",
    "version": "0.1.2",
    "project_urls": {
        "Download": "https://github.com/zl3311/lego_image_converter/archive/refs/tags/0.1.2.tar.gz",
        "Homepage": "https://github.com/zl3311/lego_image_converter"
    },
    "split_keywords": [
        "pypi",
        "lego_image_converter",
        "lego",
        "image",
        "8bit",
        "art"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d30e7fdf31ed336abe4873a51ee11fd4a26f29e3ba935edd56b2e46be1a0ad97",
                "md5": "56d1941b9a9abdfda5e08f8c286c04a2",
                "sha256": "480dd90a7cedf03d1242f321472ebd5ef5f2ff689aee1d769c84e07f7a35d9d2"
            },
            "downloads": -1,
            "filename": "lego_image_converter-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "56d1941b9a9abdfda5e08f8c286c04a2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8066,
            "upload_time": "2023-07-31T03:12:09",
            "upload_time_iso_8601": "2023-07-31T03:12:09.547832Z",
            "url": "https://files.pythonhosted.org/packages/d3/0e/7fdf31ed336abe4873a51ee11fd4a26f29e3ba935edd56b2e46be1a0ad97/lego_image_converter-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-31 03:12:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zl3311",
    "github_project": "lego_image_converter",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lego-image-converter"
}
        
Elapsed time: 0.10453s