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

Build failure due to bundle size. Advice on how to reduce please #1241

Open
DiegoMcDipster opened this issue Jun 7, 2023 · 0 comments
Open
Labels

Comments

@DiegoMcDipster
Copy link

Expected Behavior

Build succeeds.
I saw on #493 (comment) that the recommendation is to use @jimp/custom. But I have no idea how to use it for what I want to do.

I'm using jimp for cropping and merging and that's it. Here's my code:

const Jimp = typeof self !== "undefined" ? self.Jimp || _Jimp : _Jimp;

  async function mergeImages(image1: string, image2: string) {
    const jimpImage1 = await Jimp.read(image1);
    const jimpImage2 = await Jimp.read(image2);

    const mergedImage = new Jimp(
      jimpImage1.getWidth(),
      jimpImage1.getHeight() + jimpImage2.getHeight()
    );

    mergedImage.composite(jimpImage1, 0, 0);
    mergedImage.composite(jimpImage2, 0, jimpImage1.getHeight());

    return await mergedImage.getBase64Async("image/png");
  }

  const cropImage = async (image: string, isHeading: boolean) => {
    const y = isHeading ? 144 : 80;
    const croppedImage = await Jimp.read(image);

    croppedImage.crop(140, y, 940, 1400);

    return await croppedImage.getBase64Async("image/png");
  };

My question is how would I use @jimp/custom to achieve the same result?

Current Behavior

I've a NextJs app on aws amplify and now that I added jimp, the build fails because the bundle > 200MB.

Failure Information (for bugs)

CustomerError: The size of the build output (258964904) exceeds the max allowed size of 230686720 bytes

Steps to Reproduce

It's not an issue, it's advice i need.

Context

  • Jimp Version: 0.22.8
  • Operating System: Linux
  • Node version: 18

Failure Logs

CustomerError: The size of the build output (258964904) exceeds the max allowed size of 230686720 bytes

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

No branches or pull requests

2 participants