UNPKG

pixel-forge

Version:

A comprehensive generator for social media previews, favicons, and visual assets across all platforms

244 lines (243 loc) 5.84 kB
export declare function enableMockMode(): void; export declare function disableMockMode(): void; export interface ImageProcessorOptions { quality?: number; format?: 'png' | 'jpeg' | 'jpg' | 'webp' | 'avif' | 'tiff' | 'tif' | 'gif' | 'heif' | 'svg' | 'ico'; background?: string; fit?: 'cover' | 'contain' | 'fill'; zoom?: number; } export interface TextOptions { text: string; font?: string; fontSize?: number; color?: string; position?: 'center' | 'top' | 'bottom'; offset?: { x: number; y: number; }; } export declare const SUPPORTED_INPUT_FORMATS: string[]; export declare class ImageProcessor { private source; private tempFiles; constructor(source: string); /** * Check if ImageMagick is available */ static checkImageMagick(): Promise<boolean>; /** * Get the appropriate ImageMagick command */ private static getMagickCommand; /** * Create a mock output file for testing */ private createMockOutputFile; /** * Resize image to specific dimensions using ImageMagick */ resize(width: number, height: number, options?: ImageProcessorOptions): Promise<string>; /** * Add text overlay to image using ImageMagick */ addText(inputFile: string, options: TextOptions): Promise<string>; /** * Apply color overlay or tint using ImageMagick */ applyColor(inputFile: string, color: string, opacity?: number): Promise<string>; /** * Save image to file with format conversion and transparency preservation */ save(outputPath: string, options?: ImageProcessorOptions): Promise<void>; /** * Generate multiple sizes of the same image */ generateSizes(sizes: Array<{ width: number; height: number; name: string; }>, outputDir: string, options?: ImageProcessorOptions): Promise<void>; /** * Create a social media preview with template */ createSocialPreview(options: { width: number; height: number; title?: string; description?: string; logo?: string; template?: 'basic' | 'gradient' | 'custom'; background?: string; }): Promise<string>; /** * Clean up temporary files */ cleanup(): Promise<void>; } export declare const ImageSizes: { favicon: number[]; apple: number[]; android: number[]; mstile: { width: number; height: number; }[]; social: { standard: { width: number; height: number; }; facebook: { width: number; height: number; }; facebookSquare: { width: number; height: number; }; twitter: { width: number; height: number; }; twitterSquare: { width: number; height: number; }; linkedin: { width: number; height: number; }; linkedinCompany: { width: number; height: number; }; instagramSquare: { width: number; height: number; }; instagramPortrait: { width: number; height: number; }; instagramLandscape: { width: number; height: number; }; instagramStories: { width: number; height: number; }; tiktok: { width: number; height: number; }; youtubeThumbnail: { width: number; height: number; }; youtubeShorts: { width: number; height: number; }; pinterestPin: { width: number; height: number; }; pinterestSquare: { width: number; height: number; }; snapchat: { width: number; height: number; }; threads: { width: number; height: number; }; bluesky: { width: number; height: number; }; mastodon: { width: number; height: number; }; }; messaging: { standard: { width: number; height: number; }; whatsapp: { width: number; height: number; }; whatsappLink: { width: number; height: number; }; imessage: { width: number; height: number; }; discord: { width: number; height: number; }; telegram: { width: number; height: number; }; signal: { width: number; height: number; }; slack: { width: number; height: number; }; wechat: { width: number; height: number; }; line: { width: number; height: number; }; androidRcs: { width: number; height: number; }; appleBusinessChat: { width: number; height: number; }; }; video: { youtube: { width: number; height: number; }; vimeo: { width: number; height: number; }; wistia: { width: number; height: number; }; }; email: { header: { width: number; height: number; }; featured: { width: number; height: number; }; }; };