{"id":16656051,"url":"https://github.com/fhunleth/code128","last_synced_at":"2025-03-21T16:31:59.871Z","repository":{"id":6478374,"uuid":"7718487","full_name":"fhunleth/code128","owner":"fhunleth","description":"Trivial Code 128 barcode encoder","archived":false,"fork":false,"pushed_at":"2023-03-30T13:31:45.000Z","size":139,"stargazers_count":58,"open_issues_count":1,"forks_count":18,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-10-13T09:56:25.134Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fhunleth.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}},"created_at":"2013-01-20T16:25:34.000Z","updated_at":"2024-05-24T14:34:48.000Z","dependencies_parsed_at":"2023-01-11T17:00:57.549Z","dependency_job_id":null,"html_url":"https://github.com/fhunleth/code128","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fcode128","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fcode128/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fcode128/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fhunleth%2Fcode128/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fhunleth","download_url":"https://codeload.github.com/fhunleth/code128/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221817059,"owners_count":16885453,"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":[],"created_at":"2024-10-12T09:56:09.058Z","updated_at":"2024-10-28T10:29:29.518Z","avatar_url":"https://github.com/fhunleth.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GS1-128/Code 128 barcode encoder\n\nThis is a simple [GS1-128](http://en.wikipedia.org/wiki/GS1-128) barcode\nencoder library. The reason to choose it over others is simply that it is\nwritten in pure C code and has no external dependencies. That's right - it\ndoesn't even depend on a graphics library. As a bonus, the barcodes produced\nby this program will automatically use the Code 128 A, B, or C modes based\non what generates the shortest barcode.\n\nHere's how to use:\n\n```C\n    const char *str = \"[FNC1] 00 12345678 0000000001\";\n    size_t barcode_length = code128_estimate_len(str);\n    char *barcode_data = (char *) malloc(barcode_length);\n    int i;\n\n    barcode_length = code128_encode_gs1(str, barcode_data, barcode_length);\n\n    /* barcode_length is now the actual number of \"bars\". */\n    for (i = 0; i \u003c barcode_length; i++) {\n        if (barcode_data[i])\n            draw_vertical_bar_at_column(i);\n    }\n```\n\nOnce you get `barcode_data`, each byte corresponds to whether a vertical\nline should be drawn. If the byte is 0xff, then draw a line. If the byte is\n0x00, then don't.\n\n## Compiling and testing\n\nThe main library, `code128.[ch]`, doesn't have any dependencies. The test\nprogram depends on `libpng`, so make sure to install that first. On\nDebian/Ubuntu, run:\n\n```sh\nsudo apt install libpng-dev\n```\n\nOn Windows, with MSYS2, run:\n```sh\npacman -S --needed base-devel mingw-w64-x86_64-toolchain\npacman -S mingw-w64-x86_64-libpng\n```\n\nDetails on how to install and setup MSYS2 environment on Windows can be found\n[here](https://code.visualstudio.com/docs/languages/cpp) and\n[here](https://www.freecodecamp.org/news/how-to-install-c-and-cpp-compiler-on-windows/) .\n\n\nThen run `make`. The result is a test program that creates `png` files of\nbarcode data passed on the commandline.\n\nOn Windows, to build the libraries and the test program for different architectures,\nyou should open Powershell and run:\n\n```sh\nmingw-32-make.exe all\n```\n\n\nThe regression tests require [zbar](http://zbar.sourceforge.net/). Install\n`zbar` on Debian/Ubuntu by:\n\n```sh\nsudo apt install zbar-tools\n```\n\nOr on OSX:\n\n```sh\nbrew install zbar\n```\n\nThen run `make check`.\n\n## Integrating\n\nIf you're using C or C++, the easiest way of integrating this code into your\nprogram is to just copy code128.[ch] to your tree. If you're not using C,\nthen calling `code128png` from your app may be an option as well.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffhunleth%2Fcode128","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffhunleth%2Fcode128","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffhunleth%2Fcode128/lists"}