export async function convertImageToBase64(imageFileOrBlob: File | Blob): Promise { return new Promise((resolve, reject) => { const reader = new FileReader(); reader.onload = () => { if (typeof reader.result === 'string') { resolve(reader.result); } else { reject(new Error('Failed to convert image to base64')); } }; reader.onerror = () => { reject(new Error('Error reading file or blob')); }; reader.readAsDataURL(imageFileOrBlob); }); }