SShortSingh.
Back to feed

Developer shrinks 1.1 GB AI image gallery to 30 MB using WebP conversion trick

0
·3 views

A developer running a small AI photo-prompt gallery discovered that 1,541 PNG files were consuming 892 MB — about 75% of total storage — simply because the image generator exported lossless PNGs by default instead of a web-friendly format. Converting all images to WebP at quality 82 reduced the total size from 423.7 MB to just 29.8 MB, a 93% reduction, without any visible loss in image quality. Rather than overwriting originals or updating database URLs, the developer generated sibling WebP files and served them via HTML's picture element, ensuring automatic fallback for unsupported browsers and easy rollback. A surprising bug during the process caused images to be double-wrapped in picture tags due to a shortcode running through two content filters, which was fixed by stamping a data attribute on already-processed tags. The project highlighted that format choice, not image dimensions or compression levels, was the primary cause of bloat.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Microsoft's Go-Based TypeScript Compiler Delivers Up to 10x Speed Gains in TypeScript 7

Microsoft has ported the TypeScript compiler from TypeScript to Go under Project Corsa, delivering performance improvements of roughly 5x to 12x depending on project size, hardware, and workload. The decision followed extensive evaluation of multiple languages and architectures, including hybrid approaches that would keep only performance-critical parts in native code. Go was chosen primarily for compatibility reasons, as both the existing and new compilers need to coexist and share fixes during a transition period. The team also studied native tools like swc, oxc, and esbuild before concluding that a full native port would yield the greatest long-term benefits. TypeScript 7 is expected to bring these gains to developers, though the team cautions that real-world results will vary and some caveats remain before upgrading large codebases.

0
ProgrammingDEV Community ·

Eight newsletter tools compared: costs, mechanics, and which problem each actually solves

A detailed breakdown published on 2 August 2026 compares eight newsletter management tools, noting that prices and behaviours were verified against each vendor's own website on that date. The analysis draws a sharp distinction between two separate problems: inbox clutter, which requires routing newsletters elsewhere, and volume overload, which requires condensing or filtering content. Four core technical approaches appear across the tools, including dedicated intake addresses, mailbox connections via OAuth, email-to-Atom conversion, and forwarding filters. Kill the Newsletter stands out as the only tool that converts incoming emails into a plain Atom feed URL, though its FAQ warns that some publishers block relay addresses and recommends a forwarding workaround. The author discloses upfront that one of the eight tools reviewed is their own product, describing it as new and unproven, while presenting the remaining seven as established options for most readers.

0
ProgrammingDEV Community ·

Silent 5,000-row API cap caused dashboard to silently misreport search rank data

A developer discovered that an internal search-rank dashboard was silently displaying incorrect data due to a hard 5,000-row cap in a generic query endpoint, while the actual table contained 9,104 rows. The API returned a normal 200 response with no truncation warning, causing 4,104 rows to be dropped without any visible error. Because rank-change calculations depended on comparing two full time windows of data, the missing rows caused the dashboard to render dashes instead of meaningful changes. The fix involved shifting data aggregation to SQL using Postgres DISTINCT ON, returning one row per keyword rather than raw daily rows, keeping response size bounded by keyword count. The developer outlined key lessons: silent caps are silent lie generators, LIMIT without ORDER BY is nondeterministic sampling, and missing values must never render identically to zero-change values.

0
ProgrammingDEV Community ·

Fluttorch 1.0 catches silent accuracy loss when ML models are quantized for mobile

When machine learning models are exported and quantized for mobile deployment, their accuracy can quietly degrade without any build or runtime error flagging the problem. A related issue arises when preprocessing logic is written separately in Python for training and in Dart for serving, allowing the two versions to silently diverge over time. Developer Fluttorch addresses both gaps with a manifest-based system that records model shapes, data types, preprocessing constants, and a content hash at export time, preventing the Dart runtime from restating or contradicting those values independently. The tool's code generator, parity gate, and runtime all read from the single manifest, turning previously silent mismatches into compile-time errors. Version 1.0.0 of Fluttorch launched this week, and its test suite replays export-time predictions against the quantized on-device artifact to verify the two models still agree.