dlemstra / magick-wasm

The WASM library for ImageMagick

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to initialize empty size image

reggi opened this issue · comments

commented

Is your feature request related to a problem? Please describe.

I can't figure out a way to just have a blank image and populate it with text of a certain size and have that be the image. I have to guess a really large canvas size 1000 x 1000 or more and then use .trim(). This is slow if the font is 10px and the text is one character. Is there a way to resize the image based on the content once it's open 10, 10 size works 1, 1 would fail.

Describe the solution you'd like

above

Describe alternatives you've considered

No response

Additional context

No response

You can do something like this:

const settings = new MagickReadSettings();
settings.font = 'TheFontThatYouAdded'
settings.fontPointsize = 90;

ImageMagick.read('label:magick-wasm', settings, (image) => {
});
commented

Thanks this is great!