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

imagemagick hangs 😞 #271

Open
reggi opened this issue May 9, 2024 · 0 comments
Open

imagemagick hangs 😞 #271

reggi opened this issue May 9, 2024 · 0 comments

Comments

@reggi
Copy link

reggi commented May 9, 2024

I have a command here:

convert -background white -font "/System/Library/Fonts/Supplemental/Comic Sans MS.ttf" -pointsize 30 label:meow  png:- | identify -format "%w" -
77

For some reason this just hangs:

#!/usr/bin/env -S deno run --allow-all
import $ from "@david/dax"; // "dax-sh" in Node

async function getImageWidth(opts: {
  font: string;
  fontSize: number;
  text: string;
  trim?: boolean;
}) {
  const { font, fontSize, text, trim } = opts;
  const shouldTrim = trim ? "-trim" : "";
  return await $`convert -background white -font ${font} -pointsize ${fontSize} label:${text} ${shouldTrim} png:- | identify -format "%w" -`.text();
}

console.log(
  await getImageWidth({
    font: "/System/Library/Fonts/Supplemental/Comic Sans MS.ttf",
    fontSize: 30,
    text: "meow",
  })
);
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

1 participant