So is it true then that Open Toolkit 1.4 does not support the image
scale attribute? I haven't been able to find this stated clearly
anywhere.
Is there any way to get the scale attribute to work?
-Roger Hadley
I haven't been able to find
--- In dita-users@yahoogroups.com, "Edgar D' Souza"
<edgar.b.dsouza@...> wrote:
>
> Hi, Richard,
>
> On Tue, Sep 9, 2008 at 9:34 PM, Richard Simms <richard.simms@...>
wrote:
> > I'm just wondering if anyone has any insight into the correct use
of
> > the scale attribute for images? We are generating html output and
have
> > run into an issue where scaling is not working as we expected.
> >
> > The DITA 1.1 spec says this about the scale attribute:
> > "Specifies a percentage by which to scale the image in the
absence of
> > any specified image height or width; a value of 100 implies that
the
> > image should be presented at its intrinsic size. If a value has
been
> > specified for this image's height or width attribute (or both),
the
> > scale attribute is ignored."
> >
> > In an html file, I would have assumed that to scale the image I
would
> > need both the scale attribute and width and/or height so that I
could
> > adjust the width/height by the specified scaling percentage. For
> > example, if I have an image with width="66" and scale="50" then
the
> > resulting html would have width="33"
>
> Your quote from the spec says that the scale attribute is *ignored*
if
> height and/or width have values - so I don't really see how you've
> arrived at this combinatorial theory :-) It seems likelier that your
> image will be squeezed down to a width of 66 units (pixels?) and the
> scale attribute's value will be entirely ignored.
>
> > Or, is the scaling mean't to be interpreted as applying a
percentage
> > value directly to the width and height attributes. In other words,
> > scaling the image to a % of the containing block? For example, if
I
> > have an image with scale="50" then the resulting html would have
> > width="50%" and height="50%"
> >
> > Or, do I need to determine the intrinsic width and height of an
image
> > in the absence of explicit values for width and height and then
apply
> > the scaling factor to those values?
>
> As far as I understand it, and have attempted to work with these
> attributes (in PDF output, so YMMV):
> - the scale attribute scales down the image's representation in the
> XMetal editor, as a percentage of the image's actual (intrinsic, you
> call it?) width and height. This seems to follow the DITA spec.
> However, the image in the PDF output seems to totally ignore the
scale
> attribute - it seems to wind up lost somewhere down the processing
> chain.
> - the height and width attributes do work in the output PDF - they
> impose a more reasonable size on the image. I imagine it should work
> similarly in HTML output, since it is possible to specify those same
> attributes in an img element, to set the displayed size.
>
> There are two possible approaches to scaling your images:
> Someone else had posted, in another thread, about a solution that
they
> used: paste each new image into a transparent "canvas" image whose
> height and width were the maximum possible to display within the
> margins in the PDF. The pasted image was resized to fit within the
> 'canvas', then saved it as a new image which was used in the image
> element in the DITA topic. This made sure the image (screenshot or
> whatever) was already scaled down to a reasonable size *before* it
was
> processed by the DITA OT.
>
> We tried that out, and found it was a bit of extra work that had to
be
> repeated for every screenshot, and every time the screenshot was
> re-taken... which, when working with software that is undergoing
> development, happens often :-( So I wound up writing a Python script
> to slog through multiple subfolders of DITA topics, opening the
images
> referred to in each image element, retrieving their intrinsic
> height/width numbers, applying a scaling factor, and writing height
> and width attribute values to the image element in the DITA topic
> file. This has given us (thus far) acceptable output, and frees us
> from spending much time with Photoshop or equivalent image editors.
> Our current subset of three dozen or so DITA files is processed in
> under a second with this script, so we do save a bit of time as
> compared to resizing in Photoshop or GIMP/GIMPShop.
>
> HTH
> Ed.
>