-size is SILENTLY ignored as an output option

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
matteosistisette
Posts: 17
Joined: 2011-10-10T09:04:08-07:00
Authentication code: 8675308

-size is SILENTLY ignored as an output option

Post by matteosistisette »

Code: Select all

convert inputfile.jpg -size 50x50 output.jpg
Expected behavior
I guess -size only makes sense as an input option. If so, then the above command should issue an error or a warning.
Actually I think it would be even better to treat -size as a synonim of -resize when used as output option.

Observed behavior
The option is silently ignored and has no effect. The output image has the same size as the input image.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: -size is SILENTLY ignored as an output option

Post by fmw42 »

-size sets the size of a new image created with xc: or canvas:

I think you want -resize to change the size of your input image.
matteosistisette
Posts: 17
Joined: 2011-10-10T09:04:08-07:00
Authentication code: 8675308

Re: -size is SILENTLY ignored as an output option

Post by matteosistisette »

I know (as I already mentioned) that -resize is the option I wanted to use in the command above.

The problem is that if you use an option that cannot be applied in the context where it is used, an error or warning should be issued.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: -size is SILENTLY ignored as an output option

Post by magick »

The -size option sets metadata associated with the image. It appears to be an input only option but there is no reason why an image writer couldn't use this value, either now or in the future. For this reason we do not want to report it as an error or warning.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: -size is SILENTLY ignored as an output option

Post by snibgo »

As a general rule, IM processes each element of the command then moves on to the next element. Hence it doesn't know, when it processes "-size", that nothing follows that "-size" could affect.
snibgo's IM pages: im.snibgo.com
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: -size is SILENTLY ignored as an output option

Post by anthony »

That situation is even worse in the new IMv7 "magick" command 'pipelined options' where each command is processed as it arrives from a data pipeline (such as a controlling program). Whether future options may use a setting is completely unknown.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply