Density and Other Settings Specification for future IMv7

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Density and Other Settings Specification for future IMv7

Post by anthony »

If we follow the current convention then
-density sets the density for reading (vector) images
-set density sets the density within existing images.

NOTE: that -density for read also sets the density attribute of images as they are read in (like -label does).

As such really there are currently three uses of the -density option:
  • reading density for vector images;
  • set (override) the density attribute on images being read in;
  • and set density attribute on images in memory.
And this is before any addition of 'units' which probably should be included as a integral part of the density setting itself!

What I like to know just how these 3 distinctions of density (and other) settings should be handled by the future IMv7 CLI interface? The most important aspect would be clarity to users.


The distinction is subtile, and is the cause of a lot of grief in the current implementation of the Command Line Interface, not just for this but in may other image meta-data settings. It is this distintion that many options are already split into two types... for example you use -label before reading images and -set label after reading images. Also the reason their is a difference between the options -page and -repage.

See http://www.imagemagick.org/Usage/basics/#attributes

The -denisty image meta-data attribute is one that has not 'split' in this way in IMv6 and will never be.
But it is a key question for CLI redevelopment in IM v7
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
whugemann
Posts: 289
Joined: 2011-03-28T07:11:31-07:00
Authentication code: 8675308
Location: Münster, Germany 52°N,7.6°E

Re: Density and Other Settings Specification for future IMv7

Post by whugemann »

I would just skip its use in
set (override) the density attribute on images being read in
as it only causes confusion, IMHO. This use can always be substituted by setting the density after having read the image. This would also point out that setting the density is not an operation on the image but an alteration of its meta data.

Thus I see only two uses:
  • 1) defining the density beforehand when a vector image is read in (via -density)
    2) setting the density meta data in a raster image that has been read into memory (-set density)
Wolfgang Hugemann
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Density and Other Settings Specification for future IMv7

Post by anthony »

That makes sense, we could remove the ''set input denisty'' aspect but this would not be posible in IMv6
unless we differentiate the specific use the user wants. in IMv7 that difference will be required!

For example...

Code: Select all

  convert  -density 90 image.jpg  -density 300 vector.svg  .....
In this case both images will be read in and set to a density of 300!
Actually I think as IMv6 currently stands
convert -density 90 image.jpg \( -density 300 vector.svg \) ....
will by a quirk of the way options are processed, set both images to 300!
Yeap I was right it does! Both images are 300 dpi! --- Weird but true.



So how SHOULD this be handled?

If we make only -set density set in-memory image meta-data, and remove the ''set input density'' aspect, then the JPEG in the above would always remain the default 72 dpi (or what is set in the JPEG image).

This is NOT just for density, but for a whole host of meta-data setting options.

For example one bit of meta-data that is generally completely ignored when processing image is image format defined color options. For example GIF meta-data includes 'background' as a bit of saved meta-data, but typically when processing a image background is just overridden by the background color set by a user for some operation!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Density and Other Settings Specification for future IMv7

Post by fmw42 »

how about a new -meta or -set meta for meta data handling? does that help separate the issues?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Density and Other Settings Specification for future IMv7

Post by anthony »

Possibly

I am looking for ideas.. How should things work!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply