SShortSingh.
Back to feed

Why sharp and Pillow produce different JPEG file sizes at the same quality

0
·1 views

Two image libraries, sharp and Pillow, produce different JPEG byte counts at the same quality setting mainly because of default encoder options. The main difference is Huffman table optimisation, which sharp enables by default and Pillow leaves off unless told otherwise. Testing a 1920-pixel photo at quality 80, Pillow wrote 190.3 KB and sharp 185.3 KB, and with optimisation turned on in Pillow the compressed data matched almost exactly. A larger gap appears when sharp's mozjpeg option is used, since it changes the quantisation tables and cuts file size by roughly 17 to 21 percent. Pillow's default quality of 75 also differs from sharp's default of 80, so calls that omit the quality setting are not directly comparable.

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 ·

Practical tcpdump and dig commands for troubleshooting TLS and DNS issues

A guide highlights practical command-line examples for tcpdump and dig that go beyond what standard man pages offer. The tcpdump examples cover filtering connection setup and teardown packets, extracting the SNI hostname from TLS ClientHello messages, and saving full packet captures for later analysis in Wireshark. The dig examples show how to display DNSSEC records in readable multiline format, produce YAML output for scripts, trace delegation from root servers, and query authoritative servers directly to bypass cached results. The author notes these commands are most useful for failing TLS handshakes, broken DNSSEC validation, machine-readable CI output, and resolving disagreements about DNS answers. The piece encourages readers to keep the relevant commands for their own stack and to share others they rely on.

0
ProgrammingDEV Community ·

How Laravel Facades Route Cache::get() Calls Through the Service Container

Laravel's Cache::get() does not exist on the imported facade class; instead, the Facade base class uses PHP's __callStatic() to forward the call. The facade resolves a service container binding, here a CacheManager, and caches that lookup after the first request. The manager's own magic method then forwards the call to the default store named in configuration. Facades only work once the kernel's RegisterFacades bootstrapper has set the application, which is why calling them from a bare test throws an error. Real-time facades generate facade classes on demand through an autoloader, letting code call non-facade classes statically.

0
ProgrammingDEV Community ·

Seven Knowledge Management Tools Compared Across Search, Governance, and Collaboration Needs

Knowledge management tends to fail when staff cannot locate current answers, identify owners, or link information to the work it supports. A good tool should simplify organizing and searching content while offering permissions, version history, and collaboration features. This guide evaluates seven platforms, including ONES.com, Microsoft SharePoint, Guru, GitBook, Document360, Slab, and Nuclino, against these requirements. The best fit depends on where knowledge originates, how strict governance needs to be, and whether documentation must tie directly into project activity. The article also recommends defining content owners and a review process for outdated material before adoption.

0
ProgrammingDEV Community ·

Developer Launches No-Code Studio, an AI-Assisted Point-and-Click Game Engine

A developer has introduced No-Code Studio, an AI-driven engine for building point-and-click adventure games. The project aims to reduce the technical hurdles and boilerplate code that have traditionally made such games time-consuming to set up. Its visual framework is designed so creators can concentrate on storytelling, design, and puzzle mechanics while the AI-assisted environment handles much of the technical work. The core technology is described as fully developed and robust, and the product is currently in an early launch phase as a demo. The author has invited feedback and discussion from the game development and software architecture community.

Why sharp and Pillow produce different JPEG file sizes at the same quality · ShortSingh