@meghoshpritam/react-image-file-resizer
Version:
Elevate your React application with a dynamic module that empowers you to **transform and finesse** local images at will. With this enchanting tool, you wield the power to effortlessly adjust image width, height, format, rotation, and quality. Watch in aw
73 lines (66 loc) • 1.77 kB
TypeScript
declare module 'react-image-file-resizer' {
class Resizer {
static changeHeightWidth(
height: number,
maxHeight: number,
width: number,
maxWidth: number,
minWidth: number,
minHeight: number,
keepAspectRatio: boolean,
): { height: number; width: number };
static resizeAndRotateImage(
image: HTMLImageElement,
maxWidth: number,
maxHeight: number,
minWidth: number,
minHeight: number,
compressFormat?: string,
quality?: number,
rotation?: number,
keepAspectRatio?: boolean,
): string;
static b64toBlob(b64Data: string, contentType: string): Blob;
static b64toFile(b64Data: string, fileName: string, contentType: string): File;
static createResizedImage(
file: Blob,
maxWidth: number,
maxHeight: number,
compressFormat: string,
quality: number,
rotation: number,
responseUriFunc: (value: string | Blob | File | ProgressEvent<FileReader>) => void,
outputType?: string,
minWidth?: number,
minHeight?: number,
keepAspectRatio?: boolean,
): void;
}
type ImageFileResizer = ({
file,
maxWidth,
maxHeight,
compressFormat,
quality,
rotation,
responseUriFunc,
outputType,
minWidth,
minHeight,
keepAspectRatio,
}: {
file: Blob;
maxWidth: number;
maxHeight: number;
compressFormat: string;
quality: number;
rotation: number;
responseUriFunc: (value: string | Blob | File | ProgressEvent<FileReader>) => void;
outputType?: string;
minWidth?: number;
minHeight?: number;
keepAspectRatio?: boolean;
}) => void;
export const imageFileResizer: ImageFileResizer;
export default Resizer;
}