As far as I am aware, the -resize command only support natural number or percentage.
I want to resize an image into one-third of its current size. How to achieve this in ImageMagick?
Thanks
[SOLVED] Resizing image using fractional number
[SOLVED] Resizing image using fractional number
Last edited by RyanBram on 2018-04-25T01:46:34-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing image using fractional number
In IM 7 (Unix),
Please always provide your IM version and platform, since syntax may differ.
Code: Select all
magick -precision 15 image -resize "%[fx:100/3]\%" result
Re: Resizing image using fractional number
This is my current workaround. But sometimes I feel that I can work faster if I can use fraction directly without need to converting into percentage.
Eg: Sometimes it will get faster if I can set 4/16 instead of 25% or converting it to simplest fraction 1/4.
Currently I am using Windows 10 with ImageMagick 7.fmw42 wrote: ↑2018-04-24T23:19:52-07:00 In IM 7 (Unix),
Please always provide your IM version and platform, since syntax may differ.Code: Select all
magick -precision 15 image -resize "%[fx:100/3]\%" result
Is "%[fx:100/3]\%" a built in math in Unix shell or feature from ImageMagick? If it is a feature of Unix shell, is there any Windows equivalent to get similar result?
Many thanks to all of you.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Resizing image using fractional number
That is a feature of IM v7. For Windows, don't escape the percentage with a backslash.
snibgo's IM pages: im.snibgo.com
Re: Resizing image using fractional number
I created a .bat script in Windows with the following command:
But resulting the following error:
magick.exe: MissingArgument `-resize' at CLI arg 4 @ fatal/magick-cli.c/ProcessCommandOptions/444
What am I doing wrong?
Code: Select all
MAGICK -precision 15 input.png -resize "%[fx:100/3]%" output.png
magick.exe: MissingArgument `-resize' at CLI arg 4 @ fatal/magick-cli.c/ProcessCommandOptions/444
What am I doing wrong?
OS: Windows 7 Ultimate, 32-Bit
CPU: Intel Core i3 2350M @ 2.30GHz
RAM: 2.00 GB Single-Channel DDR3 @ 665MHz
IM Version: 6.8.3-8 2013-03-04 Q16
Features: DPC OpenMP
Delegates: bzlib fontconfig freetype jng jp2 jpeg lcms lzma pango png ps tiff x xml zlib
CPU: Intel Core i3 2350M @ 2.30GHz
RAM: 2.00 GB Single-Channel DDR3 @ 665MHz
IM Version: 6.8.3-8 2013-03-04 Q16
Features: DPC OpenMP
Delegates: bzlib fontconfig freetype jng jp2 jpeg lcms lzma pango png ps tiff x xml zlib
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Resizing image using fractional number
In Windows BAT, you need to double the % signs: "%%[fx:100/3]%%"
snibgo's IM pages: im.snibgo.com
Re: [SOLVED] Resizing image using fractional number
It solved.
Thank you very much for your help.
Thank you very much for your help.