UNPKG

ngx-image-cropper-facet

Version:
70 lines (69 loc) 2.28 kB
import { Observable } from 'rxjs/Observable'; export interface ImageElement extends HTMLImageElement { exif: any; iptc: any; xmp: any; } export declare class ExifService { /** * Private variables */ private _debug; private _isXmpEnabled; private _fileType; private _errorMessage; /** * Public variables */ exifTags: any; tiffTags: any; gpsTags: any; /** * EXIF 2.3 Spec */ ifd1Tags: any; stringValues: any; iptcFieldMap: any; enableXmp(): void; disableXmp(): void; fileType(imageFormat: string): void; constructor(); getData(image: HTMLImageElement | Blob | File | ArrayBuffer | string): Observable<ImageElement>; getTag(imageData: ImageElement, tag: string): any; getIptcTag(imageData: ImageElement, tag: string): any; getAllTags(imageData: ImageElement): any; getAllIptcTags(imageData: ImageElement): any; pretty(imageData: ImageElement): string; private getImageData(image); private findAndSetImageTagData(binaryFile); private addImageSourceFromArrayBuffer(data, binaryFile); private addImageSource(data, imageString); /** * Convert the ArrayBuffer to a base 64 string * * @param buffer ArrayBuffer returned from the file reader * * @return A base64 string of the provided image */ private arrayBufferToBase64(buffer); private base64ToArrayBuffer(base64); private objectURLToBlob(url, callback); private findEXIFinJPEG(file); private findIPTCinJPEG(file); private readIPTCData(file, startOffset, sectionLength); private readTags(file, tiffStart, dirStart, strings, bigEnd); private readTagValue(file, entryOffset, tiffStart, dirStart, bigEnd); private readThumbnailImage(dataView, tiffStart, firstIFDOffset, bigEnd); /** * Given an IFD (Image File Directory) start offset * returns an offset to next IFD or 0 if it's the last IFD. */ private getNextIFDOffset(dataView, dirStart, bigEnd); private readEXIFData(file, start); private getStringFromDB(buffer, start, length); private findXMPinJPEG(file); private xml2json(xml); private xml2Object(xml); private imageHasData(imageData); private log(...args); }