From 758a3e55c665096a5432c221d49bd88f22d664c5 Mon Sep 17 00:00:00 2001 From: Alessandro Riva Date: Tue, 12 Jan 2021 10:56:04 +0100 Subject: [PATCH] Added percentageResize method --- src/org/im4java/core/IMOps.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/org/im4java/core/IMOps.java b/src/org/im4java/core/IMOps.java index 0db07c1..024532b 100644 --- a/src/org/im4java/core/IMOps.java +++ b/src/org/im4java/core/IMOps.java @@ -11911,6 +11911,30 @@ public IMOps resize(Integer width) { return this; } + ////////////////////////////////////////////////////////////////////////////// + + /** + Add option -resize % to the ImageMagick commandline + (see the documentation of ImageMagick for details). + */ + + public IMOps percentageResize(Integer width) { + + String oper; // only used in some methods + StringBuffer buf = new StringBuffer(); // local buffer for option-args + iCmdArgs.add("-resize"); + + if (width != null) { + buf.append(width.toString()); + buf.append("%"); + } + if (buf.length()>0) { + iCmdArgs.add(buf.toString()); + } + return this; + } + + ////////////////////////////////////////////////////////////////////////////// /**