Skip to content

Commit

Permalink
Added density to the MagickSettings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlemstra committed Oct 26, 2024
1 parent 6798a37 commit 7ad1d8b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/settings/magick-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import { ColorSpace } from '../enums/color-space';
import { ColorType } from '../enums/color-type';
import { CompressionMethod } from '../enums/compression-method';
import { Density } from '../types/density';
import { Disposable } from '../internal/disposable';
import { Endian } from '../enums/endian';
import { IDefines } from '../defines/defines';
Expand Down Expand Up @@ -60,6 +61,11 @@ export class MagickSettings {
*/
debug?: boolean;

/**
* Gets or sets the vertical and horizontal resolution in pixels.
*/
density?: Density;

/**
* Gets or sets the depth (bits allocated to red/green/blue components).
*/
Expand Down
7 changes: 7 additions & 0 deletions src/settings/native-magick-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ export class NativeMagickSettings extends NativeInstance {
if (settings.debug !== undefined)
ImageMagick._api._MagickSettings_Debug_Set(this._instance, settings.debug ? 1 : 0);

if (settings.density !== undefined) {
const density = settings.density.toString();
density._use((ptr) => {

Check failure on line 54 in src/settings/native-magick-settings.ts

View workflow job for this annotation

GitHub Actions / Test on node 20 and macOS-latest

Parameter 'ptr' implicitly has an 'any' type.
ImageMagick._api._MagickSettings_Density_Set(this._instance, ptr);
});
}

if (settings.depth !== undefined)
ImageMagick._api._MagickSettings_Depth_Set(this._instance, settings.depth);

Expand Down

0 comments on commit 7ad1d8b

Please sign in to comment.