{"id":19666603,"url":"https://github.com/xaionaro-go/picapi","last_synced_at":"2025-02-27T04:17:29.002Z","repository":{"id":57492631,"uuid":"206403687","full_name":"xaionaro-go/picapi","owner":"xaionaro-go","description":"An HTTP server that accept an URL (to a JPEG image) and returns a resized JPEG image (like `width=100\u0026height=100\u0026url=....`)","archived":false,"fork":false,"pushed_at":"2019-09-07T07:59:20.000Z","size":1813,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-23T09:46:44.714Z","etag":null,"topics":["100krps","cache","fasthttp","golang","graphicsmagick-wrapper","high-performance","http-server","interview-task","jpeg","opencv","proxy","resize-images","service","stupid"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xaionaro-go.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":"2019-09-04T20:05:26.000Z","updated_at":"2019-09-07T07:59:21.000Z","dependencies_parsed_at":"2022-08-28T13:40:14.683Z","dependency_job_id":null,"html_url":"https://github.com/xaionaro-go/picapi","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaionaro-go%2Fpicapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaionaro-go%2Fpicapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaionaro-go%2Fpicapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xaionaro-go%2Fpicapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xaionaro-go","download_url":"https://codeload.github.com/xaionaro-go/picapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240976185,"owners_count":19887439,"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":["100krps","cache","fasthttp","golang","graphicsmagick-wrapper","high-performance","http-server","interview-task","jpeg","opencv","proxy","resize-images","service","stupid"],"created_at":"2024-11-11T16:28:15.747Z","updated_at":"2025-02-27T04:17:28.984Z","avatar_url":"https://github.com/xaionaro-go.png","language":"Go","readme":"[![Coverage Status](https://coveralls.io/repos/github/xaionaro-go/picapi/badge.svg?branch=master)](https://coveralls.io/github/xaionaro-go/picapi?branch=master)\n\n# Introduction\n\n\"PicAPI\" is an HTTP-server which implements a method to download a JPEG image and resize it.\n\n# API\n\n### `GET /resize`\n\n| GET-parameter | description | required? |\n| -------------:|:----------- | --------- |\n| url           | An URL to download the image | Y |\n| width         | resulting width (in pixels) | Y |\n| height        | resulting height (in pixels) | Y |\n\n#### Response\n\nA JPEG image will be returned as the body.\n\nIf the response is returned from a cache then a header `X-Cached-Response` will also be returned.\n\n#### cURL example:\n```sh\ncurl -s --output /tmp/resized.jpg 'http://localhost:8486/resize?width=1230\u0026height=200\u0026url=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fc%2Fc7%2FJPS-sample.jpg'\n```\n\n# Quick start\n\n### Install build dependencies (Debian/Ubuntu)\n\n```sh\nsudo apt-get install libgraphicsmagick1-dev\n```\n\nIf you're unable to use external libraries (like `graphicsmagick`) then you can switch to a native implementation (`imageprocessorimaging` or `imageprocessornfntresize` instead of `imageprocessorgraphicsmagick`) in file `imageprocessor/image_processor.go`.\n\n### Install\n\n```sh\ngo get github.com/xaionaro-go/picapi/cmd/picapid\n```\n\n### Run\n\n```sh\nPICAPI_LOGGING_LEVEL=debug $(go env GOPATH)/bin/picapid\n```\n\n# Performance test\n\n```sh\n$(go env GOPATH)/bin/picapid \u0026\n$(go env GOPATH)/bin/gobench -u 'http://localhost:8486/resize?width=10\u0026height=10\u0026url=https%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fc%2Fc7%2FJPS-sample.jpg' -t 10\n```\n\n```\nDispatching 100 clients\nWaiting for results...\n\nRequests:                          1077603 hits\nSuccessful requests:               1077603 hits\nNetwork failed:                          0 hits\nBad requests failed (!2xx):              0 hits\nSuccessful requests rate:           107760 hits/sec\nRead throughput:                  57007156 bytes/sec\nWrite throughput:                 21339232 bytes/sec\nTest time:                              10 sec\n```\n\n```\ncpufreq-info  | grep 'current policy' | head -1; echo; grep 'model name' /proc/cpuinfo  | head -1\n\n  current policy: frequency should be within 800 MHz and 3.70 GHz.\n  \nmodel name      : Intel(R) Core(TM) i7-4800MQ CPU @ 2.70GHz\n```\n\n# Packages\n\n* `imageprocessor` is a wrapper around different image manipulation tools (like imagemagick). Currently we use `graphicsmagick` as the backend.\n* `httpserver` is a wrapper around an http router (currently we use `fasthttprouter`) and `imageprocessor` to serve incoming HTTP requests.\n* `main` (`cmd/picapid`) is the entry-point/executable package.\n* `config` is just a structure to configure the `main`.\n\n# Image Processors\n\nYou mean switch it to another image processor in file `imageprocessor/image_processor.go`. See [benchmarks](imageprocessor/README.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaionaro-go%2Fpicapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxaionaro-go%2Fpicapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxaionaro-go%2Fpicapi/lists"}