Skip to content

Latest commit

History

526 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Cloud service for image storage and delivery. Upload files and accept image-filters on the fly with the simple API.

Made with ❤️ by CodeX

⚠️Warning

https://capella.pics is currently in beta.

Capella requires a project's token for image uploading. We are testing the service for a fast, stable and secure work.

You will be able to enroll your project to get a token later. Keep track of Capella's updates on https://github.com/codex-team/capella.

Content

Usage

  1. Use capella.pics site, SDK or API to upload an image.

  2. Add filters to uploaded image's URL and get processed image.

File requirements

Maximum size for the image file is 15MB.

Capella supports these types of images:

  • jpg
  • jpeg
  • png
  • gif
  • bmp
  • tiff

Please note that each uploaded file will be converted to JPG with a white background and quality 90.

Capella SDKs

Upload API

Request

You can upload image file or send link to the image from your app by making a POST request to https://capella.pics/upload with the following data:

  • file in file field or image url in link field
  • project's token in token field

You will get a JSON response from server.

Response

Each response will have at least success and message fields.

FieldTypeDescription
successBooleanRequest validness
messageStringResult message

Success

FieldTypeDescription or value
successBooleantrue
messageStringImage uploaded
idStringImage id
urlStringFull link to the uploaded image
mimeStringMime type of the uploaded image
widthIntegerImage's width
heightIntegerImage's height
colorStringAverage hex color of the image
sizeIntegerImage's size in bytes
{
"success": true,
"message": "Image uploaded",
"id": "69256e83-66e1-449a-b0c2-5414d332e3a6",
"url": "https:\/\/capella.pics\/69256e83-66e1-449a-b0c2-5414d332e3a6.jpg",
"mime": "image\/jpg",
"width": 1080,
"height": 700,
"color": "#9d908d",
"size": "176769"
}

Failure

FieldTypeDescription or value
successBooleanfalse
messageStringReason why request was failed
{
"success": false,
"message": "Wrong source mime-type"
}

List of messages for failed requests

CodeMessageDescription
400File or link is missingNo expected data was found
400File is missingFilename is missing
400Link is missingField link is empty
400Wrong source mime-typeNo support file with this mime-type
400Source is too bigFile size exceeds the limit
400Source is damagedSource has no data, size or mime-type
400Can't get headers for this URLWrong url was passed
403Project token is bad or missingRequest method is not POST
405Method not allowedRequest method is not POST
429Too Many RequestsClient has exceed plan limit. Retry later

Example

CURL

# Upload file
curl -X POST https://capella.pics/upload -F "file=@/path/to/image.png" -F "token=aaaa-bbbb-cccc-dddd"
# Upload image by link
curl -X POST https://capella.pics/upload -d "link=https://path.to/image.png" -d "token=aaaa-bbbb-cccc-dddd"

Python

# Upload fileimportrequestsimportjsonfiles= {
'file': open('./image.png','rb')
}
data= {
'token': 'aaaa-bbbb-cccc-dddd'
}
r=requests.post('https://capella.pics/upload', files=files, data=data)
response=json.loads(r.content.decode('utf-8'))
print(response)
# Upload image by linkimportrequestsimportjsondata= {
'link': 'https://path.to/image.png',
'token': 'aaaa-bbbb-cccc-dddd'
}
r=requests.post('https://capella.pics/upload', data=data)
response=json.loads(r.content.decode('utf-8'))
print(response)

Getting image

You can get each uploaded image by the following URL scheme with or without extension.

https://capella.pics/<image_id> or https://capella.pics/<image_id>.jpg

Filters

Apply filter by adding it at the end of the image URL.

https://capella.pics/<image_id>/<filter>/<params>

You can use as many filters as you want.

/<filter_1>/<params_1>/<filter_2>/<params_2>...

Note that the order of filters affects the result:

FilterResult
/resize/100/crop/200
/crop/200/resize/100

Resize

Scale the image to the largest size such that both its width and its height can fit inside the target rectangle.

ParamTypeDescription
widthIntegerMaximum images width or maximum target squares size if no height was given
heightInteger(optional) Maximum image's height

Example: https://capella.pics/<image_id>/resize/300x400

FilterResult
/resize/300x400
/resize/150

Crop

Cover the target rectangle by the image. Nice tool for creating covers or profile pics.

ParamTypeDescription
widthIntegerTarget rectangles width or target squares size if no height was given
heightInteger(optional) Target rectangle height

Example: https://capella.pics/<image_id>/crop/150

FilterResult
/crop/150
/crop/200x400
/crop/400x200
Additional params

If you need to crop an area from specified point then pass these params.

Note that this way width and height will be size params for the cropped area.

ParamTypeDescription
xIntegerLeft indent
yIntegerTop indent

Example: https://capella.pics/<image_id>/crop/400x300&500,150

FilterResult
/crop/400x300&500,150
/crop/300x400&200,150

Pixelize

Render image using large colored blocks.

ParamTypeDescription
pixelsIntegerNumber of pixels on the largest side

Example: https://capella.pics/<image_id>/pixelize/20

FilterResult
/pixelize/20
/pixelize/50

Cover

Place image to cover.

ParamTypeDescription
colorStringHex code of cover's color without hash symbol

Example: https://capella.pics/<image_id>/cover/eff2f5

FilterResult
/cover/eff2f5
/crop/150/cover/fee

Development and deployment

You can run your own Capella for usage or development. Follow our development and deployment guides.

Issues and improvements

Ask a question or report a bug on the create issue page.

Know how to improve Capella? Fork it and send pull request.

You can also drop a few lines to CodeX Team's email.

Releases

Packages

Used by

Contributors

Languages