{"id":18523997,"url":"https://github.com/sunshineplan/imgconv","last_synced_at":"2025-04-04T14:02:57.691Z","repository":{"id":38279842,"uuid":"298996091","full_name":"sunshineplan/imgconv","owner":"sunshineplan","description":"Golang image format convert, resize and watermark.","archived":false,"fork":false,"pushed_at":"2025-03-12T22:34:21.000Z","size":389,"stargazers_count":123,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T13:08:11.427Z","etag":null,"topics":["format-converter","golang","image-processing","pdf-converter","resize","watermark"],"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/sunshineplan.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":"2020-09-27T09:21:26.000Z","updated_at":"2025-03-20T03:56:16.000Z","dependencies_parsed_at":"2023-02-09T17:16:06.159Z","dependency_job_id":"aa3ca9ca-9dc8-4517-a0ca-82ca4f32520a","html_url":"https://github.com/sunshineplan/imgconv","commit_stats":{"total_commits":215,"total_committers":3,"mean_commits":71.66666666666667,"dds":0.4744186046511628,"last_synced_commit":"ab616824ba1cfc46db7fefd532d3c20ef0dfe235"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunshineplan%2Fimgconv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunshineplan%2Fimgconv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunshineplan%2Fimgconv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunshineplan%2Fimgconv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunshineplan","download_url":"https://codeload.github.com/sunshineplan/imgconv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190233,"owners_count":20898700,"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":["format-converter","golang","image-processing","pdf-converter","resize","watermark"],"created_at":"2024-11-06T17:38:59.098Z","updated_at":"2025-04-04T14:02:57.674Z","avatar_url":"https://github.com/sunshineplan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Image Converter\n\n[![GoDev](https://img.shields.io/static/v1?label=godev\u0026message=reference\u0026color=00add8)][godev]\n[![Go](https://github.com/sunshineplan/imgconv/workflows/Test/badge.svg)][actions]\n[![CoverageStatus](https://coveralls.io/repos/github/sunshineplan/imgconv/badge.svg?branch=main\u0026service=github)][coveralls]\n[![GoReportCard](https://goreportcard.com/badge/github.com/sunshineplan/imgconv)][goreportcard]\n\n[godev]: https://pkg.go.dev/github.com/sunshineplan/imgconv\n[actions]: https://github.com/sunshineplan/imgconv/actions \"GitHub Actions Page\"\n[coveralls]: https://coveralls.io/github/sunshineplan/imgconv?branch=main\n[goreportcard]: https://goreportcard.com/report/github.com/sunshineplan/imgconv\n\nPackage imgconv provides basic image processing functions (resize, add watermark, format converter.).\n\nAll the image processing functions provided by the package accept any image type that implements `image.Image` interface\nas an input, include jpg(jpeg), png, gif, tif(tiff), bmp, webp and pdf.\n\n## Installation\n\n    go get -u github.com/sunshineplan/imgconv\n\n## License\n\n[The MIT License (MIT)](https://raw.githubusercontent.com/sunshineplan/imgconv/main/LICENSE)\n\n## Credits\n\nThis repo relies on the following third-party projects:\n\n  * [disintegration/imaging](https://github.com/disintegration/imaging)\n  * [pdfcpu/pdfcpu](https://github.com/pdfcpu/pdfcpu)\n  * [hhrutter/tiff](https://github.com/hhrutter/tiff)\n  * [HugoSmits86/nativewebp](github.com/HugoSmits86/nativewebp)\n\n## Usage examples\n\nA few usage examples can be found below. See the documentation for the full list of supported functions.\n\n### Image resizing\n\n```go\n// Resize srcImage to size = 128x128px.\ndstImage128 := imgconv.Resize(srcImage, \u0026imgconv.ResizeOption{Width: 128, Height: 128})\n\n// Resize srcImage to width = 800px preserving the aspect ratio.\ndstImage800 := imgconv.Resize(srcImage, \u0026imgconv.ResizeOption{Width: 800})\n\n// Resize srcImage to 50% size preserving the aspect ratio.\ndstImagePercent50 := imgconv.Resize(srcImage, \u0026imgconv.ResizeOption{Percent: 50})\n```\n\n### Image splitting\n\n```go\n// Split srcImage into 3 parts horizontally.\nimgs, err := imgconv.Split(srcImage, 3, imgconv.SplitHorizontalMode)\n\n// Split srcImage into 3 parts vertically.\nimgs, err := imgconv.Split(srcImage, 3, imgconv.SplitVerticalMode)\n```\n\n### Add watermark\n\n```go\n// srcImage add a watermark at randomly position.\ndstImage := imgconv.Watermark(srcImage, \u0026WatermarkOption{Mark: markImage, Opacity: 128, Random: true})\n\n// srcImage add a watermark at fixed position with offset.\ndstImage := imgconv.Watermark(srcImage, \u0026WatermarkOption{Mark: markImage, Opacity: 128, Offset: image.Pt(5, 5)})\n```\n\n### Format convert\n\n```go\n// Convert srcImage to dst with jpg format.\nimgconv.Write(dstWriter, srcImage, \u0026imgconv.FormatOption{Format: imgconv.JPEG})\n```\n\n## Example code\n\n```go\npackage main\n\nimport (\n\t\"io\"\n\t\"log\"\n\n\t\"github.com/sunshineplan/imgconv\"\n)\n\nfunc main() {\n\t// Open a test image.\n\tsrc, err := imgconv.Open(\"testdata/video-001.png\")\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to open image: %v\", err)\n\t}\n\n\t// Resize the image to width = 200px preserving the aspect ratio.\n\tmark := imgconv.Resize(src, \u0026imgconv.ResizeOption{Width: 200})\n\n\t// Add random watermark set opacity = 128.\n\tdst := imgconv.Watermark(src, \u0026imgconv.WatermarkOption{Mark: mark, Opacity: 128, Random: true})\n\n\t// Write the resulting image as TIFF.\n\tif err := imgconv.Write(io.Discard, dst, \u0026imgconv.FormatOption{Format: imgconv.TIFF}); err != nil {\n\t\tlog.Fatalf(\"failed to write image: %v\", err)\n\t}\n\n\t// Split the image into 3 parts horizontally.\n\timgs, err := imgconv.Split(src, 3, imgconv.SplitHorizontalMode)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to split image: %v\", err)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunshineplan%2Fimgconv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunshineplan%2Fimgconv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunshineplan%2Fimgconv/lists"}