Page 1 of 1

No warning upon bad -size usage

Posted: 2012-06-03T19:13:54-07:00
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

Re: No warning upon bad -size usage

Posted: 2012-06-03T19:57:33-07:00
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.

Re: No warning upon bad -size usage

Posted: 2012-06-03T20:09:57-07:00
by jidanni
Yes then please warn that the user forgot the operator or something, anything.

Re: No warning upon bad -size usage

Posted: 2012-06-03T20:11:28-07:00
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.

Re: No warning upon bad -size usage

Posted: 2012-06-03T20:16:02-07:00
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.

Re: No warning upon bad -size usage

Posted: 2012-06-03T20:32:31-07:00
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.