{"id":18301401,"url":"https://github.com/lvgl/lv_lib_split_jpg","last_synced_at":"2025-04-05T14:30:52.785Z","repository":{"id":46369714,"uuid":"292839096","full_name":"lvgl/lv_lib_split_jpg","owner":"lvgl","description":"JPG decoder for LVGL ","archived":false,"fork":false,"pushed_at":"2021-10-19T16:15:40.000Z","size":776,"stargazers_count":32,"open_issues_count":0,"forks_count":12,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-03T13:45:55.943Z","etag":null,"topics":["embedded","jpg","lvgl"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lvgl.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":"2020-09-04T12:11:53.000Z","updated_at":"2024-08-21T10:57:49.000Z","dependencies_parsed_at":"2022-09-22T23:11:49.683Z","dependency_job_id":null,"html_url":"https://github.com/lvgl/lv_lib_split_jpg","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"lvgl/template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_lib_split_jpg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_lib_split_jpg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_lib_split_jpg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lvgl%2Flv_lib_split_jpg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lvgl","download_url":"https://codeload.github.com/lvgl/lv_lib_split_jpg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247352307,"owners_count":20925246,"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":["embedded","jpg","lvgl"],"created_at":"2024-11-05T15:15:55.458Z","updated_at":"2025-04-05T14:30:52.130Z","avatar_url":"https://github.com/lvgl.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JPG decoder for LVGL\n\n**This repository is merged into the lvgl repository. See https://docs.lvgl.io/master/libs/sjpg.html**\n\n![Status](https://github.com/lvgl/lv_lib_split_jpg/actions/workflows/push_audit.yml/badge.svg)\n\n## Overview\n  - lv_lib_split_jpg supports both normal jpg and the custom sjpg formats.\n  - Decoding normal jpg consumes RAM with the site fo the whole uncompressed image (recommended only for devices with more RAM)\n  - sjpg is a custom format based on \"normal\" JPG and specially made for lvgl.\n  - sjpg is 'split-jpeg' which is a bundle of small jpeg fragments with an sjpg header.\n  - sjpg size will be almost comparable to the jpg file or might be a slightly larger.\n  - lv_sjpg can open and handle multiple files at same time.\n  - File read from disk (fread) and c-array is implemented.\n  - SJPEG frame fragment cache enables fast fetching of lines if availble in cache.\n  - By default the sjpg image cache will be xres * 2 * 16 bytes (can be modified)\n  - Currently only 16 bit image format is supported (to do)\n\n## Getting started\n- Clone this repository next to lvgl with `git clone https://github.com/lvgl/lv_lib_split_jpg.git`\n- If you need to open (S)JPG files use [lv_fs_if](https://github.com/lvgl/lv_fs_if) or add your own [file system drivers](https://docs.lvgl.io/latest/en/html/overview/file-system.html).\n  - With `lv_fs_if` add these line to the end of `lv_conf.h` to enable \"PC file system\" handling\n```c\n#define LV_USE_FS_IF\t1\n#if LV_USE_FS_IF\n#  define LV_FS_IF_FATFS    '\\0'\n#  define LV_FS_IF_PC     'S'\n#endif\n```\n- For fast simulatneous multi jpg/sjpg rendering in expense of additional RAM, you can modify `LV_IMG_CACHE_DEF_SIZE` to 2 or above if testing in simulator or using it in devices like raspberry pi etc.\n- To open large JPG image a lot of dymaic memory is required. Be sure to set `LV_MEM_SIZE` to large enough value. In simulator `(4 * 1024 * 1024)` shiuld be a good start.\n\n## Example code\n```c\n#include \u003clvgl/lvgl.h\u003e\n#include \"lv_lib_split_jpg/lv_sjpg.h\"\n\nLV_IMG_DECLARE( small_image_sjpg );\nLV_IMG_DECLARE( wallpaper_jpg );\n\nvoid demo_jpg_sjpg( void )\n{\n  lv_fs_if_init();\n  lv_obj_t * img1;\n  lv_obj_t * img2;\n\n  lv_split_jpeg_init();\n  img1 = lv_img_create(lv_scr_act(), NULL);\n  img2 = lv_img_create(lv_scr_act(), NULL);\n\n  //jpg from c array\n  lv_img_set_src( img1,  \u0026wallpaper_jpg);\n\n  //sjpg from file (with lv_fs)\n  //On Windows\n  lv_img_set_src(img2,  \"S.\\\\lv_lib_split_jpg\\\\example\\\\images\\\\small_image.sjpg\");\n\n  //On Linux\n  //lv_img_set_src(img2,  \"S/lv_lib_split_jpg/example/images/small_image.sjpg\");\n}\n```\n## Converter\n\n# Converting JPG to C array\n  - Use lvgl online tool https://lvgl.io/tools/imageconverter\n  - Color format = RAW, output format = C Array\n\n# Converting JPG to SJPG\n python3 and PIL library required\n\nTo create SJPG from JPG:\n1. Drag and drop a jpeg image on top of the jpg_to_sjpg.py\n2. Run the python script on shell with jpeg filename as argument. It should generate filename.c and filename.sjpg files.\n```sh\npython3 jpg_to_sjpg.py wallpaper.jpg\n```\nExpected result:\n```sh\nConversion started...\n\nInput:\n        walpaper.jpg\n        RES = 640 x 480\n\nOutput:\n        Time taken = 1.66 sec\n        bin size = 77.1 KB\n        walpaper.sjpg           (bin file)\n        walpaper.c              (c array)\n\nAll good!\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flvgl%2Flv_lib_split_jpg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flvgl%2Flv_lib_split_jpg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flvgl%2Flv_lib_split_jpg/lists"}