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

Troubleshooting Poor Upscaling Quality with Anime4k.js #1

Open
jay8651 opened this issue Feb 22, 2024 · 1 comment
Open

Troubleshooting Poor Upscaling Quality with Anime4k.js #1

jay8651 opened this issue Feb 22, 2024 · 1 comment

Comments

@jay8651
Copy link

jay8651 commented Feb 22, 2024

Hi,

I have successfully compiled under Windows using Node.js, and as a result, I got "anime4k.js". I've also created a simple HTML.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Anime4K.js Image Upscaling</title>
    <script src="anime4k.js"></script>
</head>
<body>
    <h2>Original Image</h2>
    <img id="originalImage" src="input.jpg" alt="Original Image" width="400">
    <h2>Upscaled Image</h2>
    <canvas id="upscaledCanvas"></canvas>

    <script>
        window.onload = function() {
            // Get the image source and canvas elements
            var originalImage = document.getElementById('originalImage');
            var canvasElement = document.getElementById('upscaledCanvas');
            var textureSource = originalImage;

            // Create an instance of Anime4KJS.ImageUpscaler
            const upscaler = new Anime4KJS.ImageUpscaler(Anime4KJS.ANIME4K_HIGHEREND_MODE_A_FAST  /* PROFILE */);

            // Attach the original image and canvas element to the upscaler
            upscaler.attachSource(textureSource, canvasElement);

            // Perform the upscaling process
            upscaler.upscale();
        };
    </script>
</body>
</html>

However, the upscaling effect is worse than the original image. Could you tell me what I did wrong?

image

I will provide the compiled Anime4k.js.
https://github.com/jaymiouo/test_Anime4k.js

@monyone
Copy link
Owner

monyone commented Mar 6, 2024

@jaymiouo
Sorry for late response.
width attribute is present, rendered as specified width (downscaling) then upscale.

Please specify the size of the original image with CSS.

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