Skip to content

Quality loss when resizing picture #246

Open
@mel-mouk

Description

@mel-mouk

Hi,
I'm playing around with this library, and I stumble upon an issue.
When I try to resize pictures to make them smaller, they become very pixelated.
Not sure if it's an issue with the library or if I'm not using it properly.

Here's my code :

const params = {
        logo: "https://localhost:3000/logo.png",
	logoSize: { width: 1400, height: 510 },
}

const movie = new etro.Movie({ canvas });
movie.width = 1920 / 3;
movie.height = 1080 / 3;

const ratio = params.logoSize.width / params.logoSize.height;
const height = movie.height / 5;
const width = ratio * height;
const scene1Logo = new etro.layer.Image({
	startTime: 0,
	duration: 5,
	source: params.logo,
	x: (movie.width / 2) - (width / 2),
	y: (movie.height / 2)  - (height / 2),
	destWidth: width,
	destHeight: height,
});
movie.addLayer(scene1Logo);

And I get this result, despite my original image having a good quality :

Screenshot 2023-11-26 at 12 19 57

Can you help me ? Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions