Loading ...
Sorry, an error occurred while loading the content.

Image scaling

Expand Messages
  • Shawn McKenzie
    Is it possible to scale images so that images that would run off the page are scaled to fit, while smaller images retain their existing size. It seems like if
    Message 1 of 7 , Oct 5, 2004
    • 0 Attachment
      Is it possible to scale images so that images that would run off the
      page are scaled to fit, while smaller images retain their existing
      size.

      It seems like if you set an inline-progression-dimension.maximum as an
      attribute of fo:external-graphic this should do the trick. But I'm not
      getting the results I expect.
    • G. Ken Holman
      ... The pattern I ve seen used is: or, if
      Message 2 of 7 , Oct 5, 2004
      • 0 Attachment
        At 2004-10-05 16:18 -0700, Shawn McKenzie wrote:
        >Is it possible to scale images so that images that would run off the
        >page are scaled to fit, while smaller images retain their existing
        >size.
        >
        >It seems like if you set an inline-progression-dimension.maximum as an
        >attribute of fo:external-graphic this should do the trick. But I'm not
        >getting the results I expect.

        The pattern I've seen used is:

        <external-graphic url="......."
        width="100%" content-width="scale-to-fit"
        scaling="uniform"
        content-height="100%"/>

        or, if you want to limit by height instead of by width:

        <external-graphic url="......."
        height="100%" content-height="scale-to-fit"
        scaling="uniform"
        content-width="100%"/>

        When images are smaller than the dimension changing specification of the
        content dimension using "scale-to-fit", the image is considered to already
        fit. If the image is larger than the given dimension, that dimension is
        reduced to fit to the viewport (defined by height= or width=, in the above
        examples, the use of 100% specifies the viewport to be the full dimension
        available, you have to choose one of height or width to be the governing
        dimension since specifying both won't result in proper scaling).

        The scaling="uniform" ensures that the other image dimension is relatively
        scaled so as to not disturb the aspect ratio.

        Finally, the explicit specification of the other image dimension to 100%
        ensures that the governing content dimension specification does not distort
        the content's other dimension ... so images that are smaller than the
        governing dimension do not get stretched to 100% of that dimension's
        available size.

        I hope the explanation can be understood, and I would welcome anyone else's
        wording of what I've tried to say above ... all I know is that I learned
        the pattern from somewhere and I understand what it is doing and it has
        worked for me ... but I have to wave my arms to convey my thoughts on this.

        .................... Ken

        --
        Upcoming publicly-subscribed XSL delivery: Helsinki Oct 18-20,2004
        World-wide on-site corporate, govt. & user group XML/XSL training.
        G. Ken Holman mailto:gkholman@...
        Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
        Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
        Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
        Legal business disclaimers: http://www.CraneSoftwrights.com/legal
      • smckenzie23
        So I tried that and it is still not quite working for me. It will keep large images within a certain size, but small images are getting expanded to as large as
        Message 3 of 7 , Oct 6, 2004
        • 0 Attachment
          So I tried that and it is still not quite working for me. It will keep
          large images within a certain size, but small images are getting
          expanded to as large as they can. So just to double check:

          <fo:block-container>
          <fo:block>
          <fo:external-graphic
          width="100%"
          content-width="scale-to-fit"
          scaling="uniform"
          content-height="100%"
          src="url(./Local/Graphics/Foo.jpg)"/>
          </fo:block>
          </fo:block-container>


          Works great for keeping a large image small within the page, but small
          images expand.

          I'm going to mess around with doing this in conjunction with
          inline-progression-dimension, but I'm just grasping at straws & doing
          trial and error at this point. Any tips would be appreciated.


          --- In XSL-FO@yahoogroups.com, "G. Ken Holman" <gkholman@c...> wrote:
          > At 2004-10-05 16:18 -0700, Shawn McKenzie wrote:
          > >Is it possible to scale images so that images that would run off
          the
          > >page are scaled to fit, while smaller images retain their existing
          > >size.
          > >
          > >It seems like if you set an inline-progression-dimension.maximum
          as an
          > >attribute of fo:external-graphic this should do the trick. But I'm
          not
          > >getting the results I expect.
          >
          > The pattern I've seen used is:
          >
          > <external-graphic url="......."
          > width="100%" content-width="scale-to-fit"
          > scaling="uniform"
          > content-height="100%"/>
          >
          > or, if you want to limit by height instead of by width:
          >
          > <external-graphic url="......."
          > height="100%" content-height="scale-to-fit"
          > scaling="uniform"
          > content-width="100%"/>
          >
          > When images are smaller than the dimension changing specification of
          the
          > content dimension using "scale-to-fit", the image is considered to
          already
          > fit. If the image is larger than the given dimension, that
          dimension is
          > reduced to fit to the viewport (defined by height= or width=, in the
          above
          > examples, the use of 100% specifies the viewport to be the full
          dimension
          > available, you have to choose one of height or width to be the
          governing
          > dimension since specifying both won't result in proper scaling).
          >
          > The scaling="uniform" ensures that the other image dimension is
          relatively
          > scaled so as to not disturb the aspect ratio.
          >
          > Finally, the explicit specification of the other image dimension to
          100%
          > ensures that the governing content dimension specification does not
          distort
          > the content's other dimension ... so images that are smaller than
          the
          > governing dimension do not get stretched to 100% of that
          dimension's
          > available size.
          >
          > I hope the explanation can be understood, and I would welcome anyone
          else's
          > wording of what I've tried to say above ... all I know is that I
          learned
          > the pattern from somewhere and I understand what it is doing and it
          has
          > worked for me ... but I have to wave my arms to convey my thoughts
          on this.
          >
          > .................... Ken
          >
          > --
          > Upcoming publicly-subscribed XSL delivery: Helsinki Oct 18-20,2004
          > World-wide on-site corporate, govt. & user group XML/XSL training.
          > G. Ken Holman mailto:gkholman@C...
          > Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
          > Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
          > Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
          > Legal business disclaimers: http://www.CraneSoftwrights.com/legal
        • G. Ken Holman
          ... Hmmmmmmmm ... you don t mention which formatter you are using ... I wonder if that is the problem. ... Yep! I tested those before making my post. To be
          Message 4 of 7 , Oct 6, 2004
          • 0 Attachment
            At 2004-10-06 21:14 +0000, smckenzie23 wrote:
            >So I tried that and it is still not quite working for me.

            Hmmmmmmmm ... you don't mention which formatter you are using ... I wonder
            if that is the problem.

            >It will keep
            >large images within a certain size, but small images are getting
            >expanded to as large as they can. So just to double check:
            >
            ><fo:block-container>
            > <fo:block>
            > <fo:external-graphic
            > width="100%"
            > content-width="scale-to-fit"
            > scaling="uniform"
            > content-height="100%"
            > src="url(./Local/Graphics/Foo.jpg)"/>
            > </fo:block>
            ></fo:block-container>

            Yep! I tested those before making my post. To be sure, I selectively
            removed one of the four at a time and I never got the desired result.

            >Works great for keeping a large image small within the page, but small
            >images expand.

            I did get that when I removed content-height="100%" ... I needed that to
            limit the small image to the small size ... without it the image expanded
            to 100% of the width.

            >I'm going to mess around with doing this in conjunction with
            >inline-progression-dimension, but I'm just grasping at straws & doing
            >trial and error at this point. Any tips would be appreciated.

            I suggest you download the free evaluation versions of either Antenna House
            or RenderX and test your fragment with those. I got identical desired
            results with both packages using the properties that you've tried above.

            I didn't try with any other engines. If it works with those two but not
            with the engine you are using, then I've run out of suggestions.

            I hope this helps.

            ...................... Ken

            --
            Upcoming publicly-subscribed XSL delivery: Helsinki Oct 18-20,2004
            World-wide on-site corporate, govt. & user group XML/XSL training.
            G. Ken Holman mailto:gkholman@...
            Crane Softwrights Ltd. http://www.CraneSoftwrights.com/f/
            Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
            Male Breast Cancer Awareness http://www.CraneSoftwrights.com/f/bc
            Legal business disclaimers: http://www.CraneSoftwrights.com/legal
          • Shawn McKenzie
            ... Using Antenna House 3.1 MR2. I ll keep testing once I fix an unrelated problem. Thanks.
            Message 5 of 7 , Oct 6, 2004
            • 0 Attachment
              > Hmmmmmmmm ... you don't mention which formatter you are using ... I wonder
              > if that is the problem.

              Using Antenna House 3.1 MR2. I'll keep testing once I fix an unrelated problem.

              Thanks.
            • W. Eliot Kimber
              ... In FO 1.0 image scaling is unconditional, meaning that if you request scale to fit, it always scales, up or down. In FO 1.1, as currently drafted, scaling
              Message 6 of 7 , Oct 6, 2004
              • 0 Attachment
                smckenzie23 wrote:

                > So I tried that and it is still not quite working for me. It will keep
                > large images within a certain size, but small images are getting
                > expanded to as large as they can. So just to double check:

                In FO 1.0 image scaling is unconditional, meaning that if you request
                scale to fit, it always scales, up or down.

                In FO 1.1, as currently drafted, scaling is more sophisticated and
                flexible, so you can request to only scale down if necessary.

                Cheers,

                Eliot
                --
                W. Eliot Kimber
                Professional Services
                Innodata Isogen
                9390 Research Blvd, #410
                Austin, TX 78759
                (512) 372-8122

                eliot@...
                www.innodata-isogen.com
              • Tomoko Mayumi
                Hi, ... We released XSL Formatter V3.1 MR5. In this version, XSL Formatter changed the behavior of scaling= uniform . When scaling-uniform= uniform is set and
                Message 7 of 7 , Oct 7, 2004
                • 0 Attachment
                  Hi,

                  > Works great for keeping a large image small within the page, but small
                  > images expand.
                  We released XSL Formatter V3.1 MR5. In this version, XSL Formatter changed the
                  behavior of scaling="uniform". When scaling-uniform="uniform" is set and the
                  value is set to both content-width and content-height, the small image is not
                  expanded. The aspect ratio is kept(smaller length is based). Could you please
                  download the latest version? I hope that you see the expected result.

                  Thank you.

                  //////////////////////////////////////////
                  Tomoko Mayumi
                  XSL Group
                  Antenna House, Inc.
                  http://www.antennahouse.com/


                  Shawn McKenzie <smckenzie23@...> wrote:

                  >
                  > > Hmmmmmmmm ... you don't mention which formatter you are using ... I wonder
                  > > if that is the problem.
                  >
                  > Using Antenna House 3.1 MR2. I'll keep testing once I fix an unrelated problem.
                  >
                  > Thanks.
                  >
                  >
                  >
                  >
                  > Yahoo! Groups Links
                  >
                  >
                  >
                  >
                  >
                  >
                  >
                Your message has been successfully submitted and would be delivered to recipients shortly.