{"id":20760387,"url":"https://github.com/vanng822/imgscale","last_synced_at":"2025-04-30T05:48:26.458Z","repository":{"id":24855525,"uuid":"28270770","full_name":"vanng822/imgscale","owner":"vanng822","description":"Middleware/handler for scaling image in golang","archived":false,"fork":false,"pushed_at":"2017-02-20T02:02:11.000Z","size":407,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T05:48:18.247Z","etag":null,"topics":["golang","image-scaling","imagemagick"],"latest_commit_sha":null,"homepage":null,"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/vanng822.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":"2014-12-20T15:33:22.000Z","updated_at":"2019-11-04T09:29:52.000Z","dependencies_parsed_at":"2022-07-10T11:30:36.072Z","dependency_job_id":null,"html_url":"https://github.com/vanng822/imgscale","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanng822%2Fimgscale","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanng822%2Fimgscale/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanng822%2Fimgscale/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vanng822%2Fimgscale/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vanng822","download_url":"https://codeload.github.com/vanng822/imgscale/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251651220,"owners_count":21621702,"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":["golang","image-scaling","imagemagick"],"created_at":"2024-11-17T10:13:24.714Z","updated_at":"2025-04-30T05:48:26.431Z","avatar_url":"https://github.com/vanng822.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## imgscale\n\nMiddleware/handler for scaling image in golang. Use for serving images in different formats. Can use as middleware which is compitable with http.Handler\n\n* Crop \u0026 Scale\n* Autorotate\n* Watermark\n\n\nWarning: image processing is very resource consuming. If you use this in production you should put a cache server in front, such as Varnish.\n\n## Demo server\n\nhttp://imgscale.isgoodness.com/ is set up with arbitrary remote image. Please be nice!\n\nFormats: 100x100, 100x0, 0x360, 0x170, originalx1, original\n\nAnd the url will be http://imgscale.isgoodness.com/img/FORMAT/REMOTE_IMAGE\n\nCheck out [forest waterfall](http://imgscale.isgoodness.com/img/0x360/http://imgscale.isgoodness.com/img/0x170/http://cdn.superbwallpapers.com/wallpapers/nature/forest-waterfall-22452-1920x1080.jpg)\n\n![alt forest waterfall](http://imgscale.isgoodness.com/img/0x170/http://cdn.superbwallpapers.com/wallpapers/nature/forest-waterfall-22452-1920x1080.jpg \"\")\n\n\n## Dependencies\n\nYou need to install ImageMagick first.\n\n### MacPorts\n\t\n\tsudo port install ImageMagick\n\n### Homebrew\n\n\tbrew install imagemagick\n\t\n### Ubuntu/Debian\n\n\tsudo apt-get install libmagickwand-dev\n\n### ImageMagick binding\n\n\tgo get github.com/vanng822/imgscale/imagick\n\n## Install \n\n\tgo get github.com/vanng822/imgscale/imgscale\n\n\n## Example\n\n\t// r2router: github.com/vanng822/r2router\n\tapp := r2router.NewSeeforRouter()\n\thandler := imgscale.Configure(\"./config/formats.json\")\n\tdefer handler.Cleanup()\n\tapp.WrapHandler(handler.ServeHTTP)\n\tgo http.ListenAndServe(fmt.Sprintf(\"%s:%d\", \"127.0.0.1\", 8080), app)\n\t\n\t// Negroni\n\tapp := negroni.New()\n\thandler := imgscale.Configure(\"./config/formats.json\")\n\t// Free C pointers and terminate MagickWand environment\n\tdefer handler.Cleanup()\n\tn.UseHandler(handler)\n\tgo http.ListenAndServe(fmt.Sprintf(\"%s:%d\", \"127.0.0.1\", 8080), app)\n\n\t// Martini\n\tapp := martini.Classic()\n\thandler := imgscale.Configure(\"./config/formats.json\")\n\tdefer handler.Cleanup()\n\tapp.Use(handler.ServeHTTP)\n\tgo http.ListenAndServe(fmt.Sprintf(\"%s:%d\", \"127.0.0.1\", 8080), app)\n\n\t// http.Handler\n\thandler := imgscale.Configure(\"./config/formats.json\")\n\tdefer handler.Cleanup()\n\thttp.Handle(\"/\", handler)\n\thttp.ListenAndServe(fmt.Sprintf(\"%s:%d\", \"127.0.0.1\", 8080), nil)\n\n## GoDoc\n\n[![GoDoc](https://godoc.org/github.com/vanng822/imgscale/imgscale?status.svg)](https://godoc.org/github.com/vanng822/imgscale/imgscale)\n\n\n## Try it out\n\n### checkout\n\t\n\tgit clone https://github.com/vanng822/imgscale.git\n\t\n\n### install dependencies\n\n\tgo get github.com/gographics/imagick/imagick\n\tgo get github.com/vanng822/imgscale/imgscale\n\tgo get github.com/go-martini/martini\n\tgo get github.com/codegangsta/negroni\n\t\n\t\n### run application\n\n\tgo run example/all.go\n\n### browse it\n\t\n\thttp://127.0.0.1:8080/img/100x100/kth.jpg\n\thttp://127.0.0.1:8081/img/100x100/http://127.0.0.1:8080/img/original/kth.jpg\n\thttp://127.0.0.1:8082/img/100x100/kth.jpg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanng822%2Fimgscale","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvanng822%2Fimgscale","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvanng822%2Fimgscale/lists"}