{"id":13532383,"url":"https://github.com/DoubleCouponDay/Chunkus","last_synced_at":"2025-04-01T20:32:02.456Z","repository":{"id":43082518,"uuid":"279217921","full_name":"DoubleCouponDay/Chunkus","owner":"DoubleCouponDay","description":"Discord bot that converts your chat image to a Scalable Vector Graphic.","archived":false,"fork":false,"pushed_at":"2024-02-10T19:55:00.000Z","size":15985,"stargazers_count":6,"open_issues_count":8,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-14T13:01:35.931Z","etag":null,"topics":["c","cpp","docker","hacktoberfest","rust"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DoubleCouponDay.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":"2020-07-13T05:21:35.000Z","updated_at":"2023-04-03T20:14:57.000Z","dependencies_parsed_at":"2023-11-18T00:59:16.050Z","dependency_job_id":"33bc38da-7ba6-45be-90b9-5884a2527ca1","html_url":"https://github.com/DoubleCouponDay/Chunkus","commit_stats":null,"previous_names":["doublecouponday/vectorizer"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DoubleCouponDay%2FChunkus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DoubleCouponDay%2FChunkus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DoubleCouponDay%2FChunkus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DoubleCouponDay%2FChunkus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DoubleCouponDay","download_url":"https://codeload.github.com/DoubleCouponDay/Chunkus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709923,"owners_count":20821297,"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":["c","cpp","docker","hacktoberfest","rust"],"created_at":"2024-08-01T07:01:10.555Z","updated_at":"2025-04-01T20:31:57.444Z","avatar_url":"https://github.com/DoubleCouponDay.png","language":"C","funding_links":[],"categories":["Projects"],"sub_categories":[],"readme":"# Chunkus #\n\nConverts PNG and JPEG image files to Scalable Vector Graphic (SVG) image files.\n\nThe main algorithm is written in C. It is linked with a discord bot written in Rust. The \"vec_step\" debugger is written in C++ which can be used for debugging the svg output.\n\nThis was a group project written by Samuel, Joshua, Matthew.\n\n## Requirements\n\nWARNING: Please note that SIMD instructions are used and Intel Microprocessors without the MMX extension will not work.\n\nSet the `CHUNKUS` environment variable to the value of your discord bot's secret token.\n\n### Installing C requirements on Windows\n\nOn Windows:\n\n+ Install Visual Studio Community Edition\n+ Add the MSVC C++ Build Tools Individual Component\n+ Add the Windows SDK Individual Component\n+ Install Git using Chocolatey\n\n    choco install git\n\n+ Install Cmake using Chocolatey\n\n    choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'\n\n+ Set the `CMAKE_C_COMPILER` to this:\n\n    C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.37.32822\\bin\\Hostx64\\x64\\cl.exe\n\n    the path may vary depending on your MSVC version.\n\n### Installing C requirements on Linux\n\nOn Debian Linux:\n\n    sudo apt update -y\n\n    sudo apt install git cmake build-essential\n\nOn Arch Linux:\n\n    sudo snap install --classic cmake\n\n### Installing Rust requirements on Windows\n\nif you are on windows:\n\n    + Download and run the rustup installer.\n\n    + run the following commands:\n        rustup toolchain install stable-msvc\n\n        rustup default stable-msvc\n\n### Installing Rust Requirements on Linux\n\nOn Linux, run the follow commands:\n\n    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n\n    rustup default stable\n\n    sudo apt install build-essential libssl-dev\n\n### Installing OpenGL on Linux\n\nOn linux, run the following to install OpenGL:\n \n    sudo apt install mesa-common-dev libxi-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev -y\n\nOn Windows, OpenGL should already be available.\n\n## Building the C part\n\nUse a terminal to execute the `build.bat` / `build.sh` depending on your operating system type. It must be executed from the root directory.\n\nlinux:\n\n    ./build.sh\n\nwindows:\n\n    .\\build.bat\n\nThe C code builds to `C_part\\build`. It has to build all the dependencies and link them which can take about a minute. For a faster build time, run `debug.bat|sh` instead.\n\n## Building the Rust part \n\n\nThe rust component links to the C code, which depends on libpng, which depends on zlib.\n\nIn the `Rust_part` folder, run:\n\n    cargo build\n\nThe rust part builds to `/Rust_part/target/{BUILD_MODE}/` where BUILD_MODE = (debug|release)\n\n## Running Chunkus\n\n`cargo run --bin trampoline`\n\n## Commands \n\n### Vec: \nGoes through all attachments of the command message, executes the algorithm on them and returns the output  \n\n`!vec [attachment or URL]`  \n\n    !vec https://cdn.discordapp.com/attachments/787470274261549056/807847299752394773/ginormous.png  \n\nYou will receive a message with `output.svg.xz` compressed file and a preview png attached.\n  \n### Params: \nSets the parameters to use with the algorithm.\n\n`!params [chunk size] [thresholds] [colours]`\n\n    @Chunkus !params 1 20 256\n\n- [chunk size]\n\nChunk size is amount of width and height in the algorithm's smallest image unit. An image is broken up into chunks, where a higher number improves speed while reducing quality (and losing information).\n\nIncrease this if reducing the output image size would increase the speed of image processing.\n\n- [thresholds]\n\nThresholds is an int between 0 and 441. It is the number of threshold layers to be taking from an exponential curve.\none threshold layer is the magnitude of the difference between colours with 3 components (RGB). \nyou can use the pythagorean theorem in 3 dimensions to calculate this by:\n    \n    mag3 = sqrt(255^2 * 3)\n\n- A threshold determines how easily another colour is considered a separate shape  \n- A Threshold of 0 means any color that is not EXACTLY the same will be considered separate  \n- A threshold of 441.67 means the only color values considered different are rgb(0,0,0) and rgb(255,255,255) (white and black).\n\nUse this if you want increase the accuracy of the output image.\n\n- [colours]\n\nThe number of colours that are available for an output image. \n\nUse this if reducing the colour complexity would increase the speed of image processing.\n\n## C Tests\n---\n\nThe C code contains a test suite `vec_test.exe` which can run all C tests or just one, when given a test name. The test names can be found in `C_part/tests/main.c`.\n\n`vec_test.exe` is designed to be executed from the root folder.\n\n    install\\bin\\vec_test read_png\n\nYou can easily debug the C tests with Visual Studio Code, on Linux. \n\n    + run the `.\\build.bat` script at least once then run `.\\debug.bat` to generate debugging symbols.\n\n    + In the `Run and Debug` side menu, select the launch task `Linux: Launch Tests`, which can be configured in the `.vscode/launch.json file`. \n\n## Rust Tests\n---\n\nRust tests have been pretty much abandoned because a test cant send a discord chat message which triggers itself.\n\nThe Rust tests must be run in series.\n\n```\ncargo test -- --test-threads 1\n```\n\n## Running and Deployment\n---\nyou can run the bot on your computer or inside a docker container.\n\nYou will need to provide a docker-compose.yml file that fills the `CHUNKUS` environment variable with your discord bot token.\n\nbuild C code, then Rust code, then run `sudo docker build`. once the image is built, push it to dockerhub.\n\nFill in the blanks in the dockercompose.yml file to pass the environment variables into the container.\n\n`sudo docker-compose up --build --detach`\n\n## Debugging the C Algorithm\n---\n\nYou can use the `vec_step` GUI to step through frames on a specified iteration count of the vectorizer algorithm.\n\nOpen the Desktop App by running this:\n\n    ./build/bin/vec_step ./build/bin/test.png\n\n## Debugging on Windows\n\nEnsure the Desktop Development for C++ package is installed through VS Installer.\n\nBuild in CMake with the Visual Studio Generator.\n\nOpen the `Chunkus` solution in visual studio, from the `build` folder.\n\nIn VS, set the startup project to `vec`.\n\nIn the Debugging settings, set the Current Working Directory to `${project}../../`. This allows running tests from the root folder.\n\nPress F5 to start debugging.\n\n## FAQ\n\n### Why do we need .a library files from our Windows build instead of our Linux Build?\n\nOur current Rust build script will not link with .dll files as we are static linking.\n\n### Why did we initially choose MingW for our Build Generator?\n\nVisual Studio Code is our primary IDE and it can only debug C/C++ if you build with MingW.\n\n### Why are we using MSBuild instead of MingW on Windows?\n\nWe could potentially be using OpenCL in the future. Its CmakeLists.txt only works with MSBuild.\n\n### Why can't I see printfs in the console?\n\nRunning `vec_text` will smother calls to `printf`` but you can still use `LOG_INFO()`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDoubleCouponDay%2FChunkus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDoubleCouponDay%2FChunkus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDoubleCouponDay%2FChunkus/lists"}