Commit Graph

12 Commits

Author SHA1 Message Date
00c0522b85 debug: verify WebP blob data integrity and URL lifecycle 2025-11-17 12:19:25 +01:00
edbb5d1388 debug: add comprehensive logging for image preview issue
Added detailed logging at every step of the image conversion and preview:

ImageMagick Service:
- Log input and output sizes
- Log applied quality settings
- Verify result is not empty before creating blob
- Log created blob size and MIME type
- Fail early if conversion produces empty result

Preview Component:
- Log blob details (size, type, URL)
- Add onError handler to img tag with detailed error info
- Add onLoad handler to confirm successful loading
- Console logs will help identify:
  - Is the blob empty?
  - Is the MIME type correct?
  - Is the object URL valid?
  - What error occurs when loading?

TypeScript Fix:
- Changed result type to `Uint8Array | undefined`
- Allows proper checking before blob creation

This will help diagnose why the preview image appears broken
despite successful conversion.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 12:16:37 +01:00
4e6c68a855 debug: add detailed WASM loading diagnostics for ImageMagick
Added comprehensive logging to diagnose the WASM loading issue:
- Log the WASM URL being fetched
- Log fetch response (status, content-type, content-length)
- Log actual WASM file size after fetching
- Verify the buffer is not empty before initialization
- Pass ArrayBuffer directly to initializeImageMagick
- Better error messages with context

This will help identify why the WASM file appears empty:
- Is the fetch failing? (wrong path, 404, CORS)
- Is the response empty? (server issue)
- Is the content-type wrong? (misconfigured server)

The logs will appear in the browser console when converting images.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 12:13:01 +01:00
63cb9bcff5 fix: properly initialize ImageMagick WASM by serving from public directory
The previous approach tried to load the WASM file from a CDN or node_modules,
which resulted in an empty buffer error. This fix copies the WASM file to the
public directory so it can be served alongside the static export.

Changes:
- Copy magick.wasm (16MB) to public/wasm/ directory
- Update wasmLoader.ts to initialize with '/wasm/magick.wasm' URL
- Initialize ImageMagick only once in loadImageMagick()
- Remove redundant initialization from imagemagickService.ts
- WASM file is now served from static assets in production

This ensures:
- WASM file is accessible at runtime
- Proper initialization before image conversions
- No "empty buffer" compilation errors
- Works in both dev and production (static export)

The 16MB WASM file includes the full ImageMagick library with all
image format support and processing capabilities.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 12:09:49 +01:00
9eb66b4fa3 fix: add proper ImageMagick WASM initialization with CDN URL
The initializeImageMagick() function requires a URL argument pointing
to the WASM file. Without it, the library won't properly load and
conversions may fail.

Changes:
- Add initializeImageMagick() call with CDN URL
- Use jsDelivr CDN for magick.wasm file
- Matches the installed package version (0.0.30)

This ensures ImageMagick WASM is properly initialized before performing
image conversions, preventing potential runtime errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 12:02:05 +01:00
78394b7e97 fix: implement actual ImageMagick WASM conversion with quality settings
Previously, the ImageMagick service was just a placeholder that returned
the input data unchanged. This caused PNG to WebP conversions to have
the same file size.

Changes:
- Properly implement ImageMagick.read() with conversion logic
- Apply imageQuality option to control compression
- Apply imageWidth/imageHeight options with aspect ratio preservation
- Use correct MagickFormat enum values for output formats
- Fix write() method signature (format comes before callback)
- Remove unnecessary initializeImageMagick() call

Image conversion now properly applies:
- Quality settings (1-100%)
- Resolution/resize options
- Format-specific compression

This fixes the issue where quality settings had no effect on output
file size. Users will now see proper file size reduction when using
lower quality settings or converting to compressed formats like WebP.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:56:54 +01:00
594a0ca314 refactor: remove all document conversion support, keep only media conversions
This commit completely removes document conversion functionality to focus
exclusively on media file conversions (video, audio, images).

Changes:
- Remove all document converter services (pandocService.ts, pdfService.ts, docxService.ts)
- Uninstall document-related packages: marked, turndown, dompurify, jspdf, pdfjs-dist, docx, mammoth, @types/turndown
- Remove document formats (PDF, DOCX, Markdown, HTML, TXT) from formatMappings.ts
- Remove pandoc converter from FileConverter.tsx
- Remove pandoc loader and references from wasmLoader.ts
- Update TypeScript types to remove 'pandoc' from ConverterEngine and 'document' from FileCategory
- Remove pandoc from WASMModuleState interface
- Update README.md to remove all document conversion documentation
- Update UI descriptions to reflect media-only conversions

Supported conversions now:
- Video: MP4, WebM, AVI, MOV, MKV, GIF
- Audio: MP3, WAV, OGG, AAC, FLAC
- Images: PNG, JPG, WebP, GIF, BMP, TIFF, SVG

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:35:20 +01:00
de3997f4df feat: add comprehensive DOCX document support
- Install docx (v9.5.1) and mammoth (v1.11.0) packages
- Create docxService.ts with full DOCX read/write functionality:
  - Extract text, HTML, and Markdown from DOCX files using mammoth
  - Generate DOCX files from Markdown with proper heading levels (H1-H3)
  - Generate DOCX files from HTML and plain text
  - Automatic paragraph formatting and spacing
- Integrate DOCX conversions into pandocService.ts
- Update README with DOCX support documentation
- Add DOCX libraries to tech stack section

Supported DOCX conversions:
- DOCX → Text/HTML/Markdown
- Markdown/HTML/Text → DOCX

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:25:23 +01:00
b899989b3e feat: add comprehensive PDF support
- Add jsPDF for PDF generation from text/Markdown/HTML
- Add PDF.js for PDF text extraction (read PDFs)
- Support PDF → Text/Markdown conversions
- Support Markdown/HTML/Text → PDF conversions
- Implement page-by-page PDF text extraction
- Automatic pagination and formatting for generated PDFs

Supported PDF operations:
- Extract text from PDF files (all pages)
- Convert PDF to Markdown or plain text
- Create formatted PDFs from Markdown, HTML, or plain text
- Automatic text wrapping and page breaks

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:13:09 +01:00
9de639b138 feat: add document conversion support (Markdown, HTML, Plain Text)
- Add marked for Markdown to HTML conversion with GFM support
- Add turndown for HTML to Markdown conversion
- Add DOMPurify for HTML sanitization (security)
- Support Markdown ↔ HTML ↔ Plain Text conversions
- Add styled HTML output with responsive design
- Use client-side only DOMPurify to fix SSR issues

Supported conversions:
- Markdown → HTML (with code syntax, tables, blockquotes)
- HTML → Markdown (clean formatting preservation)
- Markdown/HTML → Plain Text (strip formatting)
- Plain Text → HTML/Markdown (basic formatting)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 11:01:08 +01:00
1d9f10fd32 fix: optimize FFmpeg encoding to reduce memory usage
- Switch from VP9 to VP8 codec for WebM (less memory-intensive)
- Add realtime encoding deadline and fast CPU preset
- Add ultrafast preset for x264 encoding
- Set explicit bitrates to control memory usage
- Use libvorbis instead of libopus for better compatibility

This fixes "memory access out of bounds" errors during video conversion
in browser environments with limited WASM memory.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 10:54:03 +01:00
1771ca42eb feat: initialize Convert UI - browser-based file conversion app
- Add Next.js 16 with Turbopack and React 19
- Add Tailwind CSS 4 with OKLCH color system
- Implement FFmpeg.wasm for video/audio conversion
- Implement ImageMagick WASM for image conversion
- Add file upload with drag-and-drop
- Add format selector with fuzzy search
- Add conversion preview and download
- Add conversion history with localStorage
- Add dark/light theme support
- Support 22+ file formats across video, audio, and images

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-17 10:44:49 +01:00