Open tictaqqn opened 2 years ago
Hi Imagemagick returns resolution with both unit PixcelsPerInch and PixcelsPerCentimeter and gm.res returns different unit of values, so I want this gm library to return Resolution Unit, too.
ex)
$ identify -verbose resolution.png | grep 'Resolution\|Units' Resolution: 118.11x118.11 Units: PixelsPerCentimeter $ identify -verbose resolution.jpg | grep 'Resolution\|Units' Resolution: 300x300 Units: PixelsPerInch
and in gm
const GM = gm.subClass({ imageMagick: true }) export function getResolution(buf: Buffer): Promise<string | undefined> { return new Promise((resolve, reject) => { GM(buf).res((err, value: string | undefined) => { if (err) { reject(err) return } resolve(value) }) }) } const buf = await fs.promises.readFile('test/assets/resolution.png') const res = await getResolution(buf) // = '118.11x118,11' in PixelsPerCentimeter //// const buf = await fs.promises.readFile('test/assets/resolution.jpg') const res = await getResolution(buf) // '300x300' in PixelsPerInch
Hi Imagemagick returns resolution with both unit PixcelsPerInch and PixcelsPerCentimeter and gm.res returns different unit of values, so I want this gm library to return Resolution Unit, too.
ex)
and in gm