No warning upon bad -size usage

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
User avatar
jidanni
Posts: 5
Joined: 2010-12-15T18:47:20-07:00
Authentication code: 8675308
Location: Taiwan
Contact:

No warning upon bad -size usage

Post by jidanni »

At least print some warning if the user uses -size instead of the intended -resize

$ convert dieyuan_logo.jpg -size 135x135 d.png
$ identify d.png
d.png PNG 400x358 400x358+0+0 8-bit DirectClass 83.5KB 0.000u 0:00.000
$ convert dieyuan_logo.jpg -resize 135x135 d.png
$ identify d.png
d.png PNG 135x121 135x121+0+0 8-bit DirectClass 16.8KB 0.010u 0:00.000
$ convert --version
Version: ImageMagick 6.7.7-2 2012-05-30 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2012 ImageMagick Studio LLC
Features: OpenMP
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: No warning upon bad -size usage

Post by fmw42 »

-size is a perfectly legal (setting type) command. But it does nothing without an operator to use the setting. Thus there is no way to know you have used the wrong command.
User avatar
jidanni
Posts: 5
Joined: 2010-12-15T18:47:20-07:00
Authentication code: 8675308
Location: Taiwan
Contact:

Re: No warning upon bad -size usage

Post by jidanni »

Yes then please warn that the user forgot the operator or something, anything.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: No warning upon bad -size usage

Post by anthony »

fmw42 wrote:-size is a perfectly legal (setting type) command. But it does nothing without an operator to use the setting. Thus there is no way to know you have used the wrong command.
Other than -- it did not do anything -- OR looking up what the option does!

-size is current only used for creation of new images.

Though that does not mean it may not in the future be used by other operations. This however is unlikely to happen.

Note at one point in IM's past it was used as a resize 'hint' for JPEG reading to limit the amount of jpeg data actually saved into memory, but this was replaced by a jpeg specific define as it interfered with its primary use as a new image setting.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: No warning upon bad -size usage

Post by anthony »

jidanni wrote:Yes then please warn that the user forgot the operator or something, anything.
And how will you know when you should warn the user?

To do so would me you would need to track is every 'setting' was actually used or not, then at the end report when a setting was not used. Note their are near a hundred of such settings, Not to mention image meta-data that may be read in and set, but then never used or saved (when converting an image). There is also lots of 'free-form' defines that may or may not actually be used by various operations (past and future).

Tracking if something is used is also more of a compiler function, and command line is an interpreter.

That request is essentially impossible without a team of programmers, and that we don't have! -- YET!


Apologies for the tone... I am tired, and work has become very busy to the point I have little time, with a very long ToDo list to finish.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
jidanni
Posts: 5
Joined: 2010-12-15T18:47:20-07:00
Authentication code: 8675308
Location: Taiwan
Contact:

Re: No warning upon bad -size usage

Post by jidanni »

Hmmm, well then maybe a general warning
"The command you gave did not change anything, but proceeding as you wish."

That could be triggered by a simple imput == output check.

OK, never mind.
Post Reply