SShortSingh.
Back to feed

Browser Canvas Technique Fits Transparent 128x128 PNGs Under 128 KB

0
·4 views

Canvas 2D's toBlob ignores the quality parameter for PNG, so developers cannot reduce file size natively when targeting strict limits like Slack's 128 KB emoji cap. A 128x128 RGBA image can exceed that ceiling once PNG encoding and compression are applied, especially with noisy or gradient-heavy artwork. The article proposes a pure TypeScript approach avoiding large WebAssembly codecs, combining background removal with palette reduction. Background keying uses a corner-seeded breadth-first flood fill, which spares enclosed foreground details that naive global color thresholding would erase. Ordered Bayer dithering and alpha-preserving quantization then reduce unique color values until the output fits the size budget.

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 ·

Keycloak Operator Flaw CVE-2026-137944 Exposes Proxy Credentials in Kubernetes

CVE-2026-137944 is a credential-disclosure flaw in the Red Hat Build of Keycloak Operator, which runs inside Kubernetes and manages Keycloak services. The operator does not normally expose a public web listener, so internet searches for Keycloak reveal identity services but cannot show whether the operator itself is affected. The article argues that the real risk lies in the cluster's control plane, where proxy values may be copied into StatefulSet specs in plain text. Recommended steps include reviewing RBAC and audit logs, rotating proxy passwords if clear values were exposed, verifying the vendor fix, and adding policies that flag credential-bearing URLs in workload environment variables.

0
ProgrammingDEV Community ·

Python DNS Automation: When Mail Evidence Justifies a Provisioning Pipeline

The article argues that a property management platform should verify mail authentication before automating DNS record changes for customer domains. It suggests keeping occasional, reviewed changes in manual consoles until a repeatable verification process exists. Automation is justified when onboarding repeatedly collects the same evidence and applies the same approval rules. The author stresses that DMARC alignment, not just a passing SPF or DKIM check or a DNS screenshot, is the key evidence to preserve. Verification records should keep the relevant identifiers, alignment mode, and result source for operator review.

0
ProgrammingDEV Community ·

Softsasi Releases Six Open-Weight LLMs for English, Bangla, and Romanized Banglish Software

Softsasi NextGen Research has fine-tuned and open-sourced six purpose-sized language models, ranging from 0.8B to 24B parameters, under the Apache-2.0 license. The team built them because monolithic APIs struggle with cost, latency, and the code-switching common in Bangladesh, where users mix English, Bengali script, and Romanized Banglish. Each model is matched to a specific software task, such as search expansion, claim verification, SQL-based business analytics, order handling, board planning, and legal document generation. The models are supported by a 430-case evaluation suite and a technical report, and they are already used in products including a hospital management system and an ERP. Production user data was scrubbed from the training datasets to protect personal information.

0
ProgrammingDEV Community ·

Developer releases five open-source tools built on Brazil's tax reform calculators

A developer has built five independent open-source projects around the RTC calculators published by Brazil's Receita Federal, which cover the CBS, IBS and Selective Tax under the country's tax reform. The tools include an MCP server for AI agents, an AI tax copilot, a FastAPI gateway with Python and TypeScript SDKs and a CLI, a web simulator comparing tax regimes, and a batch auditor for invoice files. All projects are released under the MIT license and are not affiliated with the Receita Federal. The creator stresses that the tools are not tax advice and urges users to consult legislation and an accountant. The developer invites feedback, issues and contributions to guide future development.