{"id":13413215,"url":"https://github.com/Pixboost/transformimgs","last_synced_at":"2025-03-14T19:31:42.587Z","repository":{"id":43377918,"uuid":"49362091","full_name":"Pixboost/transformimgs","owner":"Pixboost","description":"Open source image CDN.","archived":false,"fork":false,"pushed_at":"2024-03-24T09:07:13.000Z","size":13812,"stargazers_count":179,"open_issues_count":5,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-03-25T09:40:28.843Z","etag":null,"topics":["avif","golang","golang-package","image-cdn","image-compression","image-processing","jpegxl","jxl","resized-images","webp","webp-support"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/r/pixboost/transformimgs","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/Pixboost.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-01-10T10:16:08.000Z","updated_at":"2024-04-14T23:32:42.620Z","dependencies_parsed_at":"2023-10-12T12:20:10.658Z","dependency_job_id":"fda27c43-4775-473d-8229-977198de7a64","html_url":"https://github.com/Pixboost/transformimgs","commit_stats":{"total_commits":315,"total_committers":4,"mean_commits":78.75,"dds":0.053968253968254,"last_synced_commit":"c6367207abc6f5b0c368f3447a4f7847e8b13276"},"previous_names":["dooman87/transformimgs"],"tags_count":84,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixboost%2Ftransformimgs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixboost%2Ftransformimgs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixboost%2Ftransformimgs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pixboost%2Ftransformimgs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pixboost","download_url":"https://codeload.github.com/Pixboost/transformimgs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243635287,"owners_count":20322911,"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":["avif","golang","golang-package","image-cdn","image-compression","image-processing","jpegxl","jxl","resized-images","webp","webp-support"],"created_at":"2024-07-30T20:01:35.349Z","updated_at":"2025-03-14T19:31:42.580Z","avatar_url":"https://github.com/Pixboost.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"logo.png\" alt=\"logo\"/\u003e\n\u003c/p\u003e\n\n# TransformImgs\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/Pixboost/transformimgs/v8.svg)](https://pkg.go.dev/github.com/Pixboost/transformimgs/v8)\n![Go Report Card](https://goreportcard.com/badge/github.com/Pixboost/transformimgs/v8)\n![Build Status](https://github.com/Pixboost/transformimgs/actions/workflows/action.yml/badge.svg)\n[![codecov](https://codecov.io/gh/Pixboost/transformimgs/branch/main/graph/badge.svg)](https://codecov.io/gh/Pixboost/transformimgs)\n[![Docker Pulls](https://img.shields.io/docker/pulls/pixboost/transformimgs)](https://hub.docker.com/r/pixboost/transformimgs/)\n[![Docker Automated build](https://img.shields.io/docker/automated/jrottenberg/ffmpeg.svg)](https://hub.docker.com/r/pixboost/transformimgs/)\n\nOpen Source [Image CDN](https://web.dev/image-cdns/) that provides image transformation API and supports \nthe latest image formats, such as WebP, AVIF, Jpeg XL, and network client hints. \n\n\n## Table of Contents\n\n\u003c!-- TOC start --\u003e\n- [Why?](#why)\n- [Features](#features)\n- [Quickstart](#quickstart)\n- [API](#api)\n- [Running](#running-locally)\n  * [Docker](#docker)\n  * [Options](#options)\n  * [Running Locally From Source Code](#running-from-source-code)\n  * [Using from Go Web Application](#using-from-go-web-application)\n- [SaaS](#saas)\n- [Performance tests](#performance-tests)\n- [Opened tickets for images related features](#opened-tickets-for-images-related-features)\n- [Contribute](#contribute)\n- [License](#license)\n- [Todo](#todo)\n\u003c!-- TOC end --\u003e\n\n## Why?\n\n[We wrote a big blog on this](https://pixboost.com/blog/why-pixboost-is-the-best-image-cdn/), and here is TLDR:\n\nTransformimgs is an image CDN for Web, so API must cover typical use cases, like\nthumbnails, zoom in product images, etc. Any new API endpoints must \nsolve the above problems.\n\nThe goal is to have zero-config API that makes decisions based on the input, so you don't need to provide additional parameters like quality, output format, type of compression, etc.\n\nTherefore, this allows you to configure the integration once. New features, like new image formats, will work\nwith your front end automatically without any changes.\n\nTo achieve that goal we should keep API to bare minimum and hide the smartness in the implementation. \n\n## Features\n\n* Resize/optimises/crops raster (PNG and JPEG) images.\n* [JpegXL](https://jpegxl.info/) / [AVIF](https://en.wikipedia.org/wiki/AV1) / [WebP](https://developers.google.com/speed/webp/) support based on \"Accept\" header.\n* [Vary](www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.44) header support - ready to deploy behind any CDN.\n* Responsive images support including high DPI (retina) displays \n* [Save-Data](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Save-Data) support\n\n## Quickstart\n\nThere is an example of running API behind reverse proxy with integration example in `quickstart/` folder.\n\nTo run:\n\n```\ncd quickstart\ndocker-compose up\nopen https://localhost\n```\n\n## API\n\nThe API has 4 HTTP endpoints:\n\n* /img/{IMG_URL}/optimise - optimises image\n* /img/{IMG_URL}/resize - resizes image\n* /img/{IMG_URL}/fit - resize image to the exact size by resizing and cropping it\n* /img/{IMG_URL}/asis - returns original image\n\nDocs:\n* [Swagger-UI](https://pixboost.com/docs/api/) - use API key `MjUyMTM3OTQyNw__` which allows to transform any image from unsplash.com\n* [OpenAPI spec](swagger.yaml)\n\n## Running Locally\n\n### Docker\n\nThe latest docker image published on [Docker hub](https://hub.docker.com/r/pixboost/transformimgs)\n\nStarting the server:\n\n```\n$ docker run -p 8080:8080 pixboost/transformimgs [OPTIONS]\n```\n\nTo verify:\n\n* Health check: `curl http://localhost:8080/health`\n* Transformation: `open http://localhost:8080/img/https://images.unsplash.com/photo-1591769225440-811ad7d6eab3/resize?size=600`\n\n### Options\n\nEverything below is optional and have sensible defaults.\n\n| Option | Description | Default |\n|--------|-------------| ------- |\n| cache  | Number of seconds to cache image(0 to disable cache). Used in max-age HTTP response. | 2592000 (30 days) |\n| proc   | Number of images processors to run. | Number of CPUs (cores) |\n| disableSaveData | If set to true then will disable Save-Data client hint. Should be disabled on CDNs that don't support Save-Data header in Vary. | false |\n\n### Running from source code\n\nPrerequisites:\n\n* Go 1.18+ with [modules support](https://golang.org/ref/mod)\n* Installed [imagemagick v7.0.25+](http://imagemagick.org) with AVIF support in `/usr/local/bin`\n\nInstall illustration command:\n\n```bash\ncd illustration/\ngo install\n```\n\nRun the application:\n\n```bash\n./run.sh \n```\n\n### Using from Go Web Application\n\nYou could also easily plugin HTTP route into your existing web application \nusing service.GetRouter method. Here is a quick [example of how to do that](./example_test.go). \n\n## SaaS\n\nWe run SaaS version at [pixboost.com](https://pixboost.com?source=github) with generous free tier.\n\nPerks of SaaS version:\n* CDN with HTTP/3 support included\n* Dashboard with usage monitor\n* API Key support with domains allow list\n* AWS S3 integration\n* API workflows for cache busting and warmup\n* Version upgrades\n\nGo modules have been introduced in v6.\n\n## Performance tests\n\nThere is a [JMeter](https://jmeter.apache.org) performance test you can run against a service. To run tests:\n\n* Start a performance test environment:\n```\n$ docker-compose -f docker-compose-perf.yml up\n```\n* Run JMeter tests:\n```\n$ jmeter -n -t perf-test.jmx -l ./results.jmx -e -o ./results\n```\n\n* Run JMeter WebP test:\n```\n$ jmeter -n -t perf-test-webp.jmx -l ./results-webp.jmx -e -o ./results-webp\n```\n\n* Run JMeter AVIF test:\n```\n$ jmeter -n -t perf-test-avif.jmx -l ./results-avif.jmx -e -o ./results-avif\n```\n\n* Run JMeter JPEG XL test:\n```\n$ jmeter -n -t perf-test-jxl.jmx -l ./results-jxl.jmx -e -o ./results-jxl\n```\n\n\n## Opened tickets for images related features\n\n* [Safari to support Save-Data](https://bugs.webkit.org/show_bug.cgi?id=199101)\n* [Auto sizes for lazy loaded img in Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1816615)\n* [Auto sizes for lazy loaded img in Safari](https://bugs.webkit.org/show_bug.cgi?id=253143)\n\n## Contribute\n\nShout out with any ideas. PRs are more than welcome.\n\n## License\n\n[MIT](./LICENSE)\n\n## Todo\n* ~~Add JpegXR support~~ (IE supports WEBP)\n* ~~Add Jpeg 2000 support~~ (Safari support WEBP)\n* [Client Hints](https://github.com/Pixboost/transformimgs/issues/26) - on hold due to browsers adoption\n* ~~[Save-Data header](https://github.com/Pixboost/transformimgs/issues/27)~~ (Added in version 7.0.0)\n* [SVG support](https://github.com/Pixboost/transformimgs/issues/12)\n* Consider using [Zopfli](https://github.com/google/zopfli) or [Brotli](https://en.wikipedia.org/wiki/Brotli) for PNGs\n* ~~JpegXL Support since supported by Safari 17~~ (Added in version 8.12.0)\n* ~~GIF support~~ (Added in version 6.1.0)\n","funding_links":[],"categories":["Go","Images","图片"],"sub_categories":["Search and Analytic Databases","检索及分析资料库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPixboost%2Ftransformimgs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPixboost%2Ftransformimgs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPixboost%2Ftransformimgs/lists"}