DOWNLOAD_IMAGE_PROCESSING.md
docs/features/DOWNLOAD_IMAGE_PROCESSING.md
1# Download image processing23Settings → Downloads now includes tall-image splitting and image data saver.4Both are off by default. Their policies and integrations work on Android, iOS,5desktop and web. New settings live in `DbSettings.features` to preserve database6compatibility and avoid the JVM constructor-parameter limit.78## Tall images910Long manga pages can be saved as ordered JPEG tiles (quality 90), with a maximum11height from 1024–8192 pixels. Pages must be taller than twice their width.12Processing uses one permit across profiles, bounds encoded inputs to 32 MiB and13decoded inputs to 24 million pixels, and emits one tile at a time. Animated images,14unusual EXIF orientation and images exceeding the limits retain the original.15The final tile preserves the last row; transparent backgrounds become white.1617The original page and its completion marker remain until every tile and a bounded18split manifest have been committed. A restart validates the sizes of all tiles,19finishes any pending original-file deletion, or retries from the original/source.20Cancelled and failed decodes preserve the original. Uncommitted outputs are21removed before retry, and deletion failures prevent falsely completing a chapter.22Only managed manga downloads are processed; existing completed downloads and local23library originals are unchanged. Retried, incomplete pages can use the new policy.2425## Image data saver2627Optional providers:2829- **wsrv.nl:** JPEG, WebP or source format, quality, grayscale.30- **reSmush.it:** source format/colors and quality. Its API is intended for images31 under 5 MB; quality above 90 is recommended. Because its current API returns HTTP32 CDN URLs (and sampled CDN HTTPS certificates are invalid), those URLs are served33 through wsrv.nl over HTTPS with the selected quality. This is disclosed in settings.34- **Bandwidth Hero:** a user-owned public HTTPS server, JPEG/WebP, quality and grayscale.35 The server must allow browser CORS access to support the web target.3637Reader pages/covers and manga downloads can be enabled independently. JPEG/GIF URLs38and selected sources can be excluded. Reader requests carry chapter identity;39cover identity is indexed once per changed title list when exclusions are enabled.40Unidentified images retain their original when source exclusions are configured.4142Source cookies, authorization or unrecognized request headers, local/IP addresses,43plain HTTP origins, URL credentials and unrecognized query parameters bypass the44provider. No source headers are forwarded. Provider requests use Yokan's own45headers and profile-owned HTTP resources. No upstream credentials are embedded.4647Image loading retries the original on network/decoding failure. Downloads reject48non-image optimizer responses before saving a completion marker and retry through49the normal source transport. Cancellation propagates. Provider failures have a50bounded one-minute cooldown; reSmush URL caching is bounded to 128 entries and one51minute. Cache keys separate provider, quality, format and grayscale variants while52retaining reader identity and transformations. Internal progress headers are53removed before transport.5455Protocols: [wsrv format](https://wsrv.nl/docs/format),56[wsrv adjustment](https://wsrv.nl/docs/adjustment),57[reSmush API](https://resmush.it/api/),58[Bandwidth Hero parameters](https://github.com/ayastreb/bandwidth-hero-proxy/blob/master/src/params.js).5960## Browser CBZ6162The browser now streams chapter images and metadata into an OPFS CBZ, verifies the63archive index, then publishes it before removing its source folder. Active writers,64unarchived files and nested files prevent destructive folder replacement. Failed65archive writes retain the original folder. Reloads retain the completed archive.6667The offline media worker streams individual ZIP entries with backpressure, checks68CRC-32 and expanded sizes, and supports compressed images and nested image paths.69Downloaded images are naturally ordered by the shared reader adapter. HTML remains70sandboxed. Encrypted, split/ZIP64, traversal/duplicate entries and archives outside71the limits fail explicitly: archive size below 4 GiB, at most 10,000 entries, central72directory at most 4 MiB, and expanded individual files at most 64 MiB.7374zip.js 2.23.0 is vendored with its BSD license and verified package digest. The page75loads its 173 KiB bundle only for archive operations. The media worker imports it76at initialization because service workers prohibit fetching new imported scripts77after installation. Broader browser local-library import/management remains stage 5.7879Verification: the final broader run passed 249 desktop regression tests and 2680Kotlin/Wasm browser tests, with all four targets compiling. The browser's real81Skia codec decoded a tall PNG and emitted readable JPEG tiles. Real Chrome checks82passed streamed 12 MiB CBZ creation/reading, reload, compressed entries, CRC failures,83index/path limits, archive write-failure recovery and preservation of unsupported84or nested original files. The browser streaming test uses a 30-second Mocha timeout85while retaining its >64 MiB byte-count and backpressure assertions.86