lovell / lovell/sharp

premultiplied Usage: When compress png with premulitiplied, then output png shows bad.

Open
#4,413 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

## Possible bug

```
// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0

'use strict';

const sharp = require('sharp');
sharp('PariteShip.png',{ premultiplied: true })
.png({ quality: 80},{ premultiplied: true })
.toFile('compressed.png',{ premultiplied: true })

```

### What is the expected behaviour?

![Image](https://github.com/user-attachments/assets/ef7949a9-a631-4a19-ae73-fd68fd4bf8f0)

If I delete the compress code, then output png shows good.
below is the correct result
![Image](https://github.com/user-attachments/assets/c0a63d73-b590-496f-8e0d-d43472dd5caa)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the JavaScript reproduction in the issue, using the provided PariteShip.png input and comparing compressed.png with the expected images. Investigate how premultiplied is passed to sharp's input, PNG output, and toFile operations; done means compression preserves the expected image without the reported artifact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
computer-vision
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.