feat: add backend image transform types with crop support
This commit is contained in:
23
backend/src/types/image.ts
Normal file
23
backend/src/types/image.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
export type OutputFormat = "png" | "webp" | "jpeg";
|
||||||
|
|
||||||
|
export type FitMode = "inside" | "outside" | "cover" | "contain";
|
||||||
|
|
||||||
|
export type CropPosition =
|
||||||
|
| "center"
|
||||||
|
| "top"
|
||||||
|
| "right"
|
||||||
|
| "bottom"
|
||||||
|
| "left"
|
||||||
|
| "top-left"
|
||||||
|
| "top-right"
|
||||||
|
| "bottom-left"
|
||||||
|
| "bottom-right";
|
||||||
|
|
||||||
|
export interface TransformRequest {
|
||||||
|
width?: number;
|
||||||
|
height?: number;
|
||||||
|
quality?: number;
|
||||||
|
format?: OutputFormat;
|
||||||
|
fit?: FitMode; // "inside" = resize only, "cover" = crop to fill
|
||||||
|
position?: CropPosition; // crop anchor when using cover
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user