Problem with -units
Bob Friesenhahn <[email protected]> Tue, 22 Jun 2004 20:02:11 -0500 (CDT)
| Newsgroups | gmane.comp.video.graphicsmagick.tools,gmane.comp.video.graphicsmagick.core |
|---|---|
| Message-ID | <[email protected]> |
It has been brought to my attention that there is a design flaw with
-units. The current support code is similar to:
if (LocaleCompare("units",option+1) == 0)
{
image_info->units=UndefinedResolution;
if (*option == '-')
{
i++;
if (i == argc)
ThrowConvertException(OptionError,MissingArgument,option);
option=argv[i];
image_info->units=UndefinedResolution;
if (LocaleCompare("PixelsPerInch",option) == 0)
image_info->units=PixelsPerInchResolution;
if (LocaleCompare("PixelsPerCentimeter",option) == 0)
image_info->units=PixelsPerCentimeterResolution;
}
break;
}
The problem is with a command like:
gm convert in -units PixelsPerCentimeter -resample 762x762 out
Note that in this case, the interpretation of the existing image
resolution is lost entirely. In fact, it is currently only valid to
use -units in conjunction with -density.
I am planning to change the handling so that if the image has an
existing units value, that the associated image resolution values are
adjusted to match the new units scale. That way the existing image
resolution is not trashed by changing the resolution units.
The command
gm convert in -units PixelsPerCentimeter -density 762x762 out
would still work as before.
Does anyone see a problem with this approach?
Bob
======================================
Bob Friesenhahn
[email protected]
http://www.simplesystems.org/users/bfriesen
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com