{"id":13682951,"url":"https://github.com/satyarth/pixelsort","last_synced_at":"2025-04-30T10:30:32.913Z","repository":{"id":26785351,"uuid":"30243570","full_name":"satyarth/pixelsort","owner":"satyarth","description":"Pixel sorting images in python.","archived":false,"fork":false,"pushed_at":"2024-05-28T20:55:51.000Z","size":1499,"stargazers_count":754,"open_issues_count":1,"forks_count":86,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-05-29T11:43:46.336Z","etag":null,"topics":["glitch-art","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"abeltje/Test-Smoke","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/satyarth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-03T13:19:36.000Z","updated_at":"2024-06-18T06:58:30.774Z","dependencies_parsed_at":"2024-06-18T06:58:28.163Z","dependency_job_id":"71f23f81-a7cb-4dea-8cb0-6a6d7e881f9f","html_url":"https://github.com/satyarth/pixelsort","commit_stats":{"total_commits":103,"total_committers":13,"mean_commits":7.923076923076923,"dds":0.5728155339805825,"last_synced_commit":"7fc5421503b537025d5ad9d5e4f54e21e3bc168b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satyarth%2Fpixelsort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satyarth%2Fpixelsort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satyarth%2Fpixelsort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/satyarth%2Fpixelsort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/satyarth","download_url":"https://codeload.github.com/satyarth/pixelsort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224206330,"owners_count":17273437,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["glitch-art","python"],"created_at":"2024-08-02T13:01:56.259Z","updated_at":"2024-11-12T02:32:42.912Z","avatar_url":"https://github.com/satyarth.png","language":"Python","readme":"# pixelsort\n\n### What is Pixel Sorting?\n\nHave a look at [this post](http://satyarth.me/articles/pixel-sorting/) or [/r/pixelsorting](http://www.reddit.com/r/pixelsorting/top/)\n\n### Dependencies\n\nShould work in both Python 2 and 3, but Python 3 is recommended.\n\n## Usage\n\nFrom the command line:\n\n```\npip install pixelsort\npython3 -m pixelsort %PathToImage% [options]\n```\n\nTip: To replicate Kim Asendorf's original [processing script](https://github.com/kimasendorf/ASDFPixelSort), first sort vertically and then horizontally in `threshold` (default) mode:\n\n```\npython3 -m pixelsort %PathToImage% -a 90\npython3 -m pixelsort %PathToSortedImage%\n```\n\nAs a package:\n\n```\n\u003e\u003e\u003e from pixelsort import pixelsort\n\u003e\u003e\u003e from PIL import Image\n\u003e\u003e\u003e a = Image.open(\"examples/image.jpg\")\n\u003e\u003e\u003e a\n\u003cPIL.JpegImagePlugin.JpegImageFile image mode=RGB size=576x324 at 0x7F8F6A2AC208\u003e\n\u003e\u003e\u003e pixelsort(a)\n\u003cPIL.Image.Image image mode=RGBA size=576x324 at 0x7F8F66AA57B8\u003e\n```\n\n#### Parameters:\n\nParameter \t\t\t        | Flag \t| Description\n------------------------|-------|------------\nInterval function     \t| `-i`\t| Controls how the intervals used for sorting are defined. See below for more details and examples. Threshold by default.\nOutput path             | `-o`\t| Path of output file. Uses the current time for the file name by default.\nRandomness \t\t\t        | `-r`\t| What percentage of intervals *not* to sort. 0 by default.\nThreshold (lower)     \t| `-t`\t| How dark must a pixel be to be considered as a 'border' for sorting? Takes values from 0-1. 0.25 by default. Used in `edges` and `threshold` modes.\nThreshold (upper)     \t| `-u`\t| How bright must a pixel be to be considered as a 'border' for sorting? Takes values from 0-1. 0.8 by default. Used in `threshold` mode.\nChar. length\t\t        | `-c`\t| Characteristic length for the random width generator. Used in mode `random` and `waves`.\nAngle \t\t\t\t          | `-a`\t| Angle at which you're pixel sorting in degrees. `0` (horizontal) by default.\nExternal interval file \t| `-f` \t| Image used to define intervals. Must be black and white.\nSorting function        | `-s`  | Sorting function to use for sorting the pixels. Lightness by default.\nMask                    | `-m`  | Image used for masking parts of the image.\nLogging level           | `-l`  | Level of logging statements made visible. Choices include `DEBUG`, `INFO`, `WARNING`, `ERROR`, and `CRITICAL`. `WARNING` by default.\n\n#### Interval Functions\n\nInterval function | Description\n------------------|------------\n`random`\t\t\t    | Randomly generate intervals. Distribution of widths is linear by default. Interval widths can be scaled using `char_length`.\n`edges`\t\t\t\t    | Performs an edge detection, which is used to define intervals. Tweak threshold with `threshold`.\n`threshold`\t\t  \t| Intervals defined by lightness thresholds; only pixels with a lightness between the upper and lower thresholds are sorted.\n`waves`\t\t\t    \t| Intervals are waves of nearly uniform widths. Control width of waves with `char_length`.\n`file`\t\t\t    \t| Intervals taken from another specified input image. Must be black and white, and the same size as the input image.\n`file-edges`\t  \t| Intevals defined by performing edge detection on the file specified by `-f`. Must be the same size as the input image.\n`none`\t\t\t    \t| Sort whole rows, only stopping at image borders.\n\n\n#### Sorting Functions\n\nSorting function  | Description\n------------------|------------\n`lightness`       | Sort by the lightness of a pixel according to a HSL representation.\n`hue`             | Sort by the hue of a pixel according to a HSL representation.\n`saturation`      | Sort by the saturation of a pixel according to a HSL representation.\n`intensity`       | Sort by the intensity of a pixel, i.e. the sum of all the RGB values.\n`minimum`         | Sort on the minimum RGB value of a pixel (either the R, G or B).\n\n#### Examples\n\n`python3 -m pixelsort examples/image.jpg -i random -c 20`\n\n![random](/examples/random.png)\n\n`python3 -m pixelsort examples/image.jpg -i edges -t .5`\n\n![edges](/examples/edges.png)\n\n* `file`: Intervals taken from image specified with `-f`. Must be black and white.\n\n`python3 -m pixelsort examples/image.jpg -i file -f examples/intervals.png `\n\n![file](/examples/intervals.png)\n\n(generated with [elementary-ca](https://github.com/satyarth/elementary-ca))\n\n![file](/examples/file.png)\n\n* `mask`: Mask taken from image specified with `-m`. Must be black and white.\n\n`python3 -m pixelsort examples/image.jpg -i random -c 20 -m examples/mask.png`\n\n![file](/examples/mask.png)\n\n![file](/examples/masked.png)\n\n### Todo\n\n* Allow defining different intervals for different channels.\n\n---\n\nBased on https://gist.github.com/prophetgoddess/667c5554e5d9d9a25ae6\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatyarth%2Fpixelsort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsatyarth%2Fpixelsort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsatyarth%2Fpixelsort/lists"}