Skip to content

Commit

Permalink
feat(preserveAspectRatio): added option to preserve aspect ratio
Browse files Browse the repository at this point in the history
When set to true and both width and height are specified, they are interpreted as the minimum width and minimum height, respectively.
If set to true with only the width specified, the height will be automatically determined while preserving the aspect ratio, and vice versa.

fixes #88, #189
  • Loading branch information
mskec committed Nov 18, 2023
1 parent c543022 commit b517177
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/graphics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ export class Graphics {
}

public gmBaseCommand(stream: fs.ReadStream, filename: string): gm.State {
// console.log(JSON.stringify({ width: this.width, height: this.height, preserveAspectRatio: this.preserveAspectRatio, density: this.density }))
return this.gm(stream, filename)
.density(this.density, this.density)
.resize(this.width, this.height, this.preserveAspectRatio ? '^' : '!')
Expand Down

0 comments on commit b517177

Please sign in to comment.