import { CSSProperties, ImgHTMLAttributes } from 'vue';
export type HeicOutputType = 'image/png' | 'image/gif' | 'image/jpeg';
export interface HeicOptions {
/**
* Sometimes the heic file contains multiple files, so when outputting image/jpeg or image/png
* you will get only the primary image (if found) or the first image.
* Setting this option to true will output multiple images in form of array of blob files.
*/
multiple?: boolean;
/**
* The output image format.
* - image/png: Maximum quality & still image
* - image/jpeg: Configurable quality with the quality option
* - image/gif: For animated HEIC files
*/
toType?: HeicOutputType;
/**
* The quality parameter for JPEG output (between 0 and 1).
* Only considered when outputting image/jpeg.
*/
quality?: number;
/**
* How many seconds for the gif image to move from one frame to another.
* Only considered when using image/gif.
*/
gifInterval?: number;
/**
* When true, try to display HEIC with the browser without converting (e.g. Safari).
* Only applies when the file is HEIC, `multiple` is false, and `toType` is `image/png`
* (display path). If native display fails or is unavailable, falls back to heic2any.
*/
preferNativeHeic?: boolean;
}
/** Payload for the `converted` event on `HeicImage` */
export interface HeicConvertedPayload {
blobs: Blob | Blob[];
isHeic: boolean;
usedNative: boolean;
}
/** Subset of img attributes forwarded by `HeicImage` */
export type HeicImageImgAttrs = Pick & {
/**
* Applied as CSS `object-fit` on the rendered <img> element(s).
*/
objectFit?: CSSProperties['objectFit'];
/**
* Forwarded to <img fetchpriority> where supported.
*/
fetchpriority?: 'high' | 'low' | 'auto';
};
export interface HeicImageProps extends HeicOptions, /* @vue-ignore */ HeicImageImgAttrs {
/**
* The source of the HEIC image.
* Can be a File object, Blob, or URL string.
*/
src: File | Blob | string;
/**
* Alternative text for the image
*/
alt?: string;
/**
* CSS class names to apply to the image
*/
class?: string;
/**
* Width of the image in pixels
*/
width?: number | string;
/**
* Height of the image in pixels
*/
height?: number | string;
}