Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draw gif on canvas with fixed size get blurry #50

Open
dim0147 opened this issue Sep 7, 2022 · 2 comments
Open

Draw gif on canvas with fixed size get blurry #50

dim0147 opened this issue Sep 7, 2022 · 2 comments

Comments

@dim0147
Copy link

dim0147 commented Sep 7, 2022

Hi, I draw the gif with canvas fixed size but the image get blur. For example, I want the gif to be drawn at 300x300, I follow this code:

const gif = parseGIF(arrayBuffer);
const frames = decompressFrames(gif, true);
const frame = frames[0];
var dims = frame.dims;

const frameImageData = tempCtx.createImageData(dims.width, dims.height);

// set the patch data as an override
frameImageData.data.set(frame.patch);

// draw the patch back over the canvas
tempCtx.putImageData(frameImageData, 0, 0);

ctx.drawImage(tempCanvas, dims.left, dims.top, 300, 300);

the image is blurry and I'm not sure what I'm missing here, thanks

@dim0147 dim0147 changed the title Draw gif on canvas with fixed size Draw gif on canvas with fixed size get blurry Sep 7, 2022
@eric-yates
Copy link

eric-yates commented Apr 26, 2023

I'm having the same issue. Did you ever resolve @dim0147?

@eric-yates
Copy link

@dim0147 I resolved the issue in my case. Check out this answer I made to another issue and see if it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants