{"id":15797265,"url":"https://github.com/xtensor-stack/xtensor-io","last_synced_at":"2025-05-08T04:37:45.647Z","repository":{"id":27127988,"uuid":"108169810","full_name":"xtensor-stack/xtensor-io","owner":"xtensor-stack","description":"xtensor plugin to read and write images, audio files, numpy (compressed) npz and HDF5","archived":false,"fork":false,"pushed_at":"2024-04-02T04:05:57.000Z","size":765,"stargazers_count":85,"open_issues_count":23,"forks_count":28,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-10-12T00:26:34.315Z","etag":null,"topics":["audio-files","compressed","cpp","hdf5","image-files","io","npz","numpy","xtensor"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xtensor-stack.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":"2017-10-24T18:52:41.000Z","updated_at":"2024-08-05T11:38:12.000Z","dependencies_parsed_at":"2024-10-26T05:53:02.192Z","dependency_job_id":"9592dadf-a92c-4f87-a813-55075e14d741","html_url":"https://github.com/xtensor-stack/xtensor-io","commit_stats":{"total_commits":217,"total_committers":15,"mean_commits":"14.466666666666667","dds":0.7050691244239631,"last_synced_commit":"a96674992af48b75c14b1ee6c4580d7abd979afe"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtensor-stack%2Fxtensor-io","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtensor-stack%2Fxtensor-io/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtensor-stack%2Fxtensor-io/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xtensor-stack%2Fxtensor-io/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xtensor-stack","download_url":"https://codeload.github.com/xtensor-stack/xtensor-io/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231474812,"owners_count":18382160,"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":["audio-files","compressed","cpp","hdf5","image-files","io","npz","numpy","xtensor"],"created_at":"2024-10-05T00:05:57.076Z","updated_at":"2024-12-27T11:14:06.192Z","avatar_url":"https://github.com/xtensor-stack.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![xtensor-io](docs/source/xtensor-io.svg)\n\n[![Azure Pipelines](https://dev.azure.com/xtensor-stack/xtensor-stack/_apis/build/status/xtensor-stack.xtensor-io?branchName=master)](https://dev.azure.com/xtensor-stack/xtensor-stack/_build/latest?definitionId=8\u0026branchName=master)\n[![ReadTheDocs](https://readthedocs.org/projects/xtensor-io/badge/?version=stable)](http://xtensor-io.readthedocs.io/en/stable/)\n[![Binder](https://img.shields.io/badge/launch-binder-brightgreen.svg)](https://mybinder.org/v2/gh/xtensor-stack/xtensor-io/stable?filepath=notebooks%2Fdemo.ipynb)\n[![Join the Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/QuantStack/Lobby?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nReading and writing image, sound and npz file formats to and from xtensor data structures. \u003cbr\u003e\n[Try it live in the browser!](https://mybinder.org/v2/gh/xtensor-stack/xtensor-io/stable?filepath=notebooks%2Fdemo.ipynb)\n\n## Introduction\n\n`xtensor-io` offers an API to read and write various file formats into `xtensor` data structures:\n\n - images,\n - audio files,\n - NumPy's compressed storage format (NPZ),\n - HDF5 files,\n - Blosc.\n\n`xtensor-io` wraps the [OpenImageIO](https://github.com/OpenImageIO/oiio), [libsndfile](https://github.com/erikd/libsndfile), [zlib](https://github.com/madler/zlib), [HighFive](https://github.com/BlueBrain/HighFive), and [blosc](https://github.com/Blosc/c-blosc) libraries.\n\n## Installation\n\n`xtensor-io` is a header-only library. We provide a package for the mamba (or conda) package manager.\n\n```bash\nmamba install xtensor-io -c conda-forge\n```\n\n- `xtensor-io` depends on `xtensor` `^0.25.0`.\n\n- `OpenImageIO`, `libsndfile`, `zlib`, `HighFive`, and `blosc` are optional dependencies to `xtensor-io`\n\n  - `OpenImageIO` is required to read and write image files.\n  - `libsndfile` is required to read and write sound files.\n  - `zlib` is required to load NPZ files.\n  - `HighFive` (and the `HDF5` library) is required to read and write HDF5 files.\n  - `blosc` is required to read and write Blosc files.\n\nAll five libraries are available for the conda package manager.\n\nYou can also install `xtensor-io` from source:\n\n```\nmkdir build\ncd build\ncmake ..\nmake\nsudo make install\n```\n\n## Trying it online\n\nTo try out xtensor-io interactively in your web browser, just click on the binder\nlink:\n\n[![Binder](binder-logo.svg)](https://mybinder.org/v2/gh/xtensor-stack/xtensor-io/stable?filepath=notebooks%2Fdemo.ipynb)\n\n## Documentation\n\nTo get started with using `xtensor-io`, check out the full documentation\n\nhttp://xtensor-io.readthedocs.io/\n\n## Usage\n\n```cpp\n// loads png image into xarray with shape HEIGHT x WIDTH x CHANNELS\nauto img_arr = xt::load_image(\"test.png\");\n\n// write xarray out to JPEG image\nxt::dump_image(\"dumptest.jpg\", img_arr + 5);\n\n// load npz file containing multiple arrays\nauto npy_map = xt::load_npz(\"test.npz\");\n\nauto arr_0 = npy_map[\"arr_0\"].cast\u003cdouble\u003e();\nauto arr_1 = npy_map[\"arr_1\"].cast\u003cunsigned long\u003e();\n\n// open a wav file\nauto audio = xt::load_audio(\"files/xtensor.wav\");\nauto\u0026 audio_arr = std::get\u003c1\u003e(audio); // audio contents (like scipy.io.wavfile results)\n\n// save a sine wave sound\nint freq = 2000;\nint sampling_freq = 44100;\ndouble duration = 1.0;\n\nauto t = xt::arange(0.0, duration, 1.0 / sampling_freq);\nauto y = xt::sin(2.0 * xt::numeric_constants\u003cdouble\u003e::PI * freq * t);\n\nxt::dump_audio(\"files/sine.wav\", y, sampling_freq);\n```\n\n## License\n\nWe use a shared copyright model that enables all contributors to maintain the\ncopyright on their contributions.\n\nThis software is licensed under the BSD-3-Clause license. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtensor-stack%2Fxtensor-io","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxtensor-stack%2Fxtensor-io","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxtensor-stack%2Fxtensor-io/lists"}