Crop images optionally after resizing (#125)

This commit is contained in:
Janos Dobronszki
2021-05-24 15:54:37 +01:00
committed by GitHub
parent 09052d83e1
commit f6cc5af43f
3 changed files with 369 additions and 72 deletions

View File

@@ -26,8 +26,31 @@ message UploadResponse {
string url = 1;
}
message Point {
int32 x = 1;
int32 y = 2;
}
message Rectangle {
Point min = 1;
Point max = 2;
}
message CropOptions {
// width to crop to
int32 width = 1;
// height to crop to
int32 height = 2;
// Crop anchor point: "top", "top left", "top right",
// "left", "center", "right"
// "bottom left", "bottom", "bottom right".
// Optional. Defaults to center.
string anchor = 3;
}
// Resize an image on the fly without storing it (by sending and receiving a base64 encoded image), or resize and upload depending on parameters.
// If one of width or height is 0, the image aspect ratio is preserved.
// Optional cropping.
message ResizeRequest {
// base64 encoded image to resize,
// ie. "data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
@@ -40,6 +63,10 @@ message ResizeRequest {
bool outputURL = 4;
int64 width = 5;
int64 height = 6;
// optional crop options
// if provided, after resize, the image
// will be cropped
CropOptions cropOptions = 7;
}
message ResizeResponse {