You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Alexander Koppelhuber <to...@gmx.net> on 2002/11/27 15:11:25 UTC

automatic image scaling

In my fo file I have the following part:

<fo:block-container width="118mm" height="502px" top="107mm"
position="absolute" >
	<fo:block>
      	<fo:external-graphic src="url('../img/martina.jpg')"
content-height="auto" content-width="auto"/>
      </fo:block>
</fo:block-container>

With this settings of the block-container everything works fine.
The image is larger in width an gets scaled correctly. However, if I
change the height parameter of the container to my desired value
no image will be rendered. The image is slightly larger than the needed
size of the container. It seems that automatic scaling of an image
only works if the height of the block container is the exact height of
the image. Other combinations (block.width = img.width +
block.height<img.height ||
block.height/block.height < img.width/img.height) don't work, and no image
gets
rendered. Any workarounds for this bug (if it is one)?

This is not a big problem but a litte bit annoying, because part of the fo
file gets
generated by my application (different images can be used with varying
size).

Regards, Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: AW: automatic image scaling

Posted by Keiron Liddle <ke...@aftexsw.com>.
On Wed, 2002-11-27 at 16:17, Alexander Koppelhuber wrote:
> if block-container.height >= img.height and block-container.width <
> img.width then
> the image gets scaled to the width of the block-containter (gets smaller);
> 
> if bloc-container.height >= img.height and block-container.width >=
> img.width then
> the image gets rendered according to the image size (no scaling is done)
> 
> if bloc-container.height < img.height then no image is rendered
> no matter which values are used for width

This is because the line containing the image cannot fit within the
block container so it displays nothing. The correct behaviour should put
the image there as normal and then handle the overflow.

> content-width and content-height do not have any effect at all
> 
> 
> I hope that this behaviour isn't just coincidence.

It doesn't sound totally correct.

There is some scaling done, that attempts to make it fit on the page
(not block container) that scales down to the area width and the page
height.
This appears to be causing the behaviour you are observing.

I'm not sure how you could work around the problem.



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: AW: automatic image scaling

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Alexander Koppelhuber wrote:

> content-width and content-height do not have any effect at all
They are just not implemented yet.

-- 
Oleg Tkachenko
eXperanto team
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: automatic image scaling

Posted by Roland Neilands <rn...@pulsemining.com.au>.
Alex,

> > <fo:block-container width="118mm" height="502px" top="107mm"
> > position="absolute" >
> > 	<fo:block>
> >       	<fo:external-graphic src="url('../img/martina.jpg')"

width="118mm" height="502px" scaling="uniform"

> > content-height="auto" content-width="auto"/>
> >       </fo:block>
> > </fo:block-container>

Add height & width into the fo:external-graphic tag to scale the image to
this size. scaling="uniform" preserves the aspect ratio. You might still
have problems with excessively large files.

Cheers,
Roland.



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


AW: automatic image scaling

Posted by Alexander Koppelhuber <to...@gmx.net>.
if block-container.height >= img.height and block-container.width <
img.width then
the image gets scaled to the width of the block-containter (gets smaller);

if bloc-container.height >= img.height and block-container.width >=
img.width then
the image gets rendered according to the image size (no scaling is done)

if bloc-container.height < img.height then no image is rendered
no matter which values are used for width

content-width and content-height do not have any effect at all


I hope that this behaviour isn't just coincidence.

-----Ursprüngliche Nachricht-----
Von: Keiron Liddle [mailto:keiron@aftexsw.com]
Gesendet: Mittwoch, 27. November 2002 15:31
An: fop-user@xml.apache.org
Betreff: Re: automatic image scaling


On Wed, 2002-11-27 at 15:11, Alexander Koppelhuber wrote:
> In my fo file I have the following part:
>
> <fo:block-container width="118mm" height="502px" top="107mm"
> position="absolute" >
> 	<fo:block>
>       	<fo:external-graphic src="url('../img/martina.jpg')"
> content-height="auto" content-width="auto"/>
>       </fo:block>
> </fo:block-container>

IIRC the content-width and content-height of auto means that it should
use the width and height of the image. It does not have an relation to
the surrounding block, that would be width="100%" and height="100%" I
think.
These things are not currently implemented.

> With this settings of the block-container everything works fine.
> The image is larger in width an gets scaled correctly. However, if I
> change the height parameter of the container to my desired value
> no image will be rendered. The image is slightly larger than the needed
> size of the container. It seems that automatic scaling of an image
> only works if the height of the block container is the exact height of
> the image. Other combinations (block.width = img.width +
> block.height<img.height ||
> block.height/block.height < img.width/img.height) don't work, and no image
> gets
> rendered. Any workarounds for this bug (if it is one)?

I suspect that if it does not fit, ie. smaller than the block-container,
it will not display anything. Can you simply make the block-container
larger so it will fit all images.

If there is scaling happening then I'm not sure exactly what attributes
are making it work.

If you want all images to be the same size can you set the width and
height attributes to a pt value and will that work?

> This is not a big problem but a litte bit annoying, because part of the fo
> file gets
> generated by my application (different images can be used with varying
> size).
>
> Regards, Alex



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: automatic image scaling

Posted by Keiron Liddle <ke...@aftexsw.com>.
On Wed, 2002-11-27 at 15:11, Alexander Koppelhuber wrote:
> In my fo file I have the following part:
> 
> <fo:block-container width="118mm" height="502px" top="107mm"
> position="absolute" >
> 	<fo:block>
>       	<fo:external-graphic src="url('../img/martina.jpg')"
> content-height="auto" content-width="auto"/>
>       </fo:block>
> </fo:block-container>

IIRC the content-width and content-height of auto means that it should
use the width and height of the image. It does not have an relation to
the surrounding block, that would be width="100%" and height="100%" I
think.
These things are not currently implemented.

> With this settings of the block-container everything works fine.
> The image is larger in width an gets scaled correctly. However, if I
> change the height parameter of the container to my desired value
> no image will be rendered. The image is slightly larger than the needed
> size of the container. It seems that automatic scaling of an image
> only works if the height of the block container is the exact height of
> the image. Other combinations (block.width = img.width +
> block.height<img.height ||
> block.height/block.height < img.width/img.height) don't work, and no image
> gets
> rendered. Any workarounds for this bug (if it is one)?

I suspect that if it does not fit, ie. smaller than the block-container,
it will not display anything. Can you simply make the block-container
larger so it will fit all images.

If there is scaling happening then I'm not sure exactly what attributes
are making it work.

If you want all images to be the same size can you set the width and
height attributes to a pt value and will that work?

> This is not a big problem but a litte bit annoying, because part of the fo
> file gets
> generated by my application (different images can be used with varying
> size).
> 
> Regards, Alex



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org