Skip to content

pngRecompress wrong calculation for medium min/max values #4

@Flohs

Description

@Flohs

The pngRecompress function fails when passing high values for example min: 93 and max: 99 due to the medium calculation.

I belive it is related to this method. When using min: 40 and max: 99 it works again.

const pngRecompress = async function (min, max, input, output) {
	let temporaryFile;
	let lastResult;
	const results = [];
	const qualities = [max, min];
	const medium = Math.floor((min + max) / 2);
	const mediumMax = Math.round((medium + max) / 2);
	const mediumMin = Math.floor((medium + min) / 2);
	const inputMd5 = md5(input);
        ...

At the moment the png compression fails with the values min: 93 and max: 99

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions