Skip to content

Resize image and save it #29

Answered by X7md
X7md asked this question in Q&A
Discussion options

You must be logged in to vote

Btw, after trying.

This work.

import * as util from "util";
import * as fs from "fs";

import {ImageMagick,
 initializeImageMagick}
 from '@imagemagick/magick-wasm'
import * as MagickFormat
 from '@imagemagick/magick-wasm/magick-format.js'
import { MagickReadSettings }
 from '@imagemagick/magick-wasm/settings/magick-read-settings.js'
const readFile = util.promisify(fs.readFile);
const writeFile = util.promisify(fs.writeFile);
initializeImageMagick().then(async () => {
const readSettings = new MagickReadSettings(
{
    format: MagickFormat.Jpeg
});
const inputData = 
 await readFile("Higehiro-episode-3.jpg");

await ImageMagick.read(inputData, readSettings, async (image) => {
    image.resize

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by X7md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant