Images and scaling


Wayne Brissette
 

So, I've been asked to help with a scaling issue that an author is having with a larger image. I'm a little confused about some of the wording in the 1.2 Spec (we're still on 1.2 ... yeah, I know...). ;)

The Spec states that pixels is the default, so I would assume that an attribute of height="45" would be 45 pixels. OK, but then it also states valid options are pc, px, pt, mm, cm, and in. All of that makes sense. But then it states that if either height is provided but not width that the width is scaled the same amount as the height. Likewise for Width if that is provided but not height.

So, is there a way to instead of using a hard value use a percentage? it doesn't look like it, but it looks like the OT has the logic to scale. So I might be able to use 45 to indicate that an image needs to be scaled 45% of the original size.

-Wayne


Kristen James Eberlein
 

Use the @scale attribute on image, and do not use @height or @width.

Kris Eberlein

On Jun 10, 2021, at 11:32 AM, Wayne Brissette via groups.io <wbrisett=att.net@groups.io> wrote:

So, I've been asked to help with a scaling issue that an author is having with a larger image. I'm a little confused about some of the wording in the 1.2 Spec (we're still on 1.2 ... yeah, I know...). ;)

The Spec states that pixels is the default, so I would assume that an attribute of height="45" would be 45 pixels. OK, but then it also states valid options are pc, px, pt, mm, cm, and in. All of that makes sense. But then it states that if either height is provided but not width that the width is scaled the same amount as the height. Likewise for Width if that is provided but not height.

So, is there a way to instead of using a hard value use a percentage? it doesn't look like it, but it looks like the OT has the logic to scale. So I might be able to use 45 to indicate that an image needs to be scaled 45% of the original size.

-Wayne





Wayne Brissette
 

Kristen James Eberlein wrote on 2021-06-10 10:41:
Use the @scale attribute on image, and do not use @height or @width.

Kris Eberlein
Yeah, I was afraid that was going to be the proper answer here... this is all part of our custom markdown to DITA tooling, and thus they want me to support the HTML-ish scale 40% this way, and 60% that way... ;) I think I'll have just tell them to use one value.

Thanks Kris!

Wayne


ekimber@contrext.com
 

One possible workaround is to use ImageMagick to generate XML with the details of each image, from which a transform can then make informed decisions about sizing in the DITA being generated.

Cheers,

E.

--
Eliot Kimber
http://contrext.com


On 6/10/21, 10:55 AM, "Wayne Brissette" <main@dita-users.groups.io on behalf of wbrisett@att.net> wrote:



Kristen James Eberlein wrote on 2021-06-10 10:41:
> Use the @scale attribute on image, and do not use @height or @width.
>
> Kris Eberlein

Yeah, I was afraid that was going to be the proper answer here... this
is all part of our custom markdown to DITA tooling, and thus they want
me to support the HTML-ish scale 40% this way, and 60% that way... ;) I
think I'll have just tell them to use one value.

Thanks Kris!

Wayne