{"id":13413195,"url":"https://github.com/davidbyttow/govips","last_synced_at":"2025-05-12T15:30:01.397Z","repository":{"id":14915345,"uuid":"77310444","full_name":"davidbyttow/govips","owner":"davidbyttow","description":"A lightning fast image processing and resizing library for Go","archived":false,"fork":false,"pushed_at":"2025-04-16T23:23:40.000Z","size":190870,"stargazers_count":1418,"open_issues_count":37,"forks_count":207,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-03T09:04:27.752Z","etag":null,"topics":["gif","golang","heic","image-processing","imagemagick","jpeg","libvips","pdf","png","svg","tiff","webp"],"latest_commit_sha":null,"homepage":"","language":"Go","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/davidbyttow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2016-12-25T04:32:56.000Z","updated_at":"2025-05-01T17:49:48.000Z","dependencies_parsed_at":"2025-04-23T18:49:31.716Z","dependency_job_id":null,"html_url":"https://github.com/davidbyttow/govips","commit_stats":{"total_commits":640,"total_committers":74,"mean_commits":8.64864864864865,"dds":0.7625,"last_synced_commit":"d925c837080f462cb83b6593aece2eed68840395"},"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbyttow%2Fgovips","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbyttow%2Fgovips/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbyttow%2Fgovips/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidbyttow%2Fgovips/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidbyttow","download_url":"https://codeload.github.com/davidbyttow/govips/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253765632,"owners_count":21960763,"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":["gif","golang","heic","image-processing","imagemagick","jpeg","libvips","pdf","png","svg","tiff","webp"],"created_at":"2024-07-30T20:01:34.901Z","updated_at":"2025-05-12T15:30:01.350Z","avatar_url":"https://github.com/davidbyttow.png","language":"Go","funding_links":[],"categories":["Images","图片","Go","Relational Databases"],"sub_categories":["Search and Analytic Databases","检索及分析资料库","Advanced Console UIs"],"readme":"# \u003cimg src=\"https://raw.githubusercontent.com/davidbyttow/govips/master/assets/SVG/govips.svg\" width=\"90\" height=\"90\"\u003e \u003cspan style=\"font-size: 4em;\"\u003egovips\u003c/span\u003e\n\n[![GoDoc](https://godoc.org/github.com/davidbyttow/govips?status.svg)](https://pkg.go.dev/mod/github.com/davidbyttow/govips/v2) [![Go Report Card](https://goreportcard.com/badge/github.com/davidbyttow/govips)](https://goreportcard.com/badge/github.com/davidbyttow/govips) ![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/davidbyttow/govips) ![License](https://img.shields.io/badge/license-MIT-blue.svg) [![Build Status](https://github.com/davidbyttow/govips/workflows/build/badge.svg)](https://github.com/davidbyttow/govips/actions) [![Coverage Status](https://img.shields.io/coveralls/github/davidbyttow/govips)](https://coveralls.io/github/davidbyttow/govips?branch=master)\n\n## A lightning fast image processing and resizing library for Go\n\nThis package wraps the core functionality of [libvips](https://github.com/libvips/libvips) image processing library by exposing all image operations on first-class types in Go.\n\nLibvips is generally 4-8x faster than other graphics processors such as GraphicsMagick and ImageMagick. Check the benchmark: [Speed and Memory Use](https://github.com/libvips/libvips/wiki/Speed-and-memory-use)\n\nThe intent for this is to enable developers to build extremely fast image processors in Go, which is suited well for concurrent requests.\n\n## Requirements\n\n-   [libvips](https://github.com/libvips/libvips) 8.10+\n-   C compatible compiler such as gcc 4.6+ or clang 3.0+\n-   Go 1.16+\n\n## Dependencies\n\n### MacOS\n\nUse [homebrew](https://brew.sh/) to install vips and pkg-config:\n\n```bash\nbrew install vips pkg-config\n```\n\n### Windows\n\nThe recommended approach on Windows is to use Govips via WSL and Ubuntu.\n\nIf you need to run Govips natively on Windows, it's not difficult but will require some effort. We don't have a recommended environment or setup at the moment. Windows is also not in our list of CI/CD targets so Govips is not regularly tested for compatibility. If you would be willing to setup and maintain a robust CI/CD Windows environment, please open a PR, we would be pleased to accept your contribution and support Windows as a platform.\n\n## Installation\n\n```bash\ngo get -u github.com/davidbyttow/govips/v2/vips\n```\n\n### MacOS note\n\nOn MacOS, govips may not compile without first setting an environment variable:\n\n```bash\nexport CGO_CFLAGS_ALLOW=\"-Xpreprocessor\"\n```\n\n## Example usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/davidbyttow/govips/v2/vips\"\n)\n\nfunc checkError(err error) {\n\tif err != nil {\n\t\tfmt.Println(\"error:\", err)\n\t\tos.Exit(1)\n\t}\n}\n\nfunc main() {\n\tvips.Startup(nil)\n\tdefer vips.Shutdown()\n\n\timage1, err := vips.NewImageFromFile(\"input.jpg\")\n\tcheckError(err)\n\n\t// Rotate the picture upright and reset EXIF orientation tag\n\terr = image1.AutoRotate()\n\tcheckError(err)\n\n\tep := vips.NewDefaultJPEGExportParams()\n\timage1bytes, _, err := image1.Export(ep)\n\terr = os.WriteFile(\"output.jpg\", image1bytes, 0644)\n\tcheckError(err)\n\n}\n```\n\nSee _examples/_ folder for more examples.\n\n## Running tests\n\n```bash\n$ make test\n```\n\n## Memory usage note\n### MALLOC_ARENA_MAX\n`libvips` uses GLib for memory management, and it brings GLib memory fragmentation\nissues to heavily multi-threaded programs. First thing you can try if you noticed\nconstantly growing RSS usage without Go's sys memory growth is set `MALLOC_ARENA_MAX`:\n\n```\nMALLOC_ARENA_MAX=2 application\n```\n\nThis will reduce GLib memory appetites by reducing the number of malloc arenas\nthat it can create. By default GLib creates one are per thread, and this would\nfollow to memory fragmentation.\n\n### Jemalloc\nIf the arena option doesn't help, you can try replacing the standard allocator with `jemalloc`,\nwhich emphasizes fragmentation avoidance and scalable concurrency support.\n\nTo do this, you need to install the `libjemalloc-dev` package. \nAnd pass the following flags for build command:\n\n```\nCGO_CFLAGS=\"-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free\" CGO_LDFLAGS=\"-ljemalloc\" go build\n```\n\n\n## Contributing\n\nFeel free to file issues or create pull requests. See this [guide on contributing](https://github.com/davidbyttow/govips/blob/master/CONTRIBUTING.md) for more information.\n\n## Credits\n\nThanks to:\n\n-   [John Cupitt](https://github.com/jcupitt) for creating and maintaining libvips\n-   [Toni Melisma](https://github.com/tonimelisma) for pushing to a 2.x release\n-   [wix.com](https://wix.com/) for the govips logo and lots of great functionality\n-   All of our fantastic [contributors](https://github.com/davidbyttow/govips/graphs/contributors)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidbyttow%2Fgovips","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidbyttow%2Fgovips","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidbyttow%2Fgovips/lists"}