Hi Klearchos,

Since Luis has reproduced your issue, I came back on it (thanks, Luis).

When *-progression-dimension.maximum are equal, the issue comes when a
square image is used.

Please, can you fill in an issue on Bugzilla, providing the attached
short test case (FO + 2 jpeg).

Workaround:
as Luis said, different values for *-p-d.maximum give expected result.

Note that on inline axis, you can use percent values, since it is
computed regarding the i-p-d of the parent FO element.
So, as a good practice, you can set i-p-d.maximum="100%".
This is not applicable to b-p-d axis, since the b-p-d of the parent
element depends on its content.

Le 24/01/2012 09:11, Klearchos Klearchou a écrit :
> Hello Luis,
> 
> thank you very much for the workaround.
> I will apply it now.
> 
> Kind regards,
> Klearchos
> 
> 
> 
> On 24/1/2012 12:42 AM, Luis Bernardo wrote:
>>
>> There is indeed a strange bug with the stock FOP 1.0 (and in trunk 
>> too...).
>>
>> Klearchos, if you set one of the dimensions to 90.01mm in the code 
>> below then you get the behavior you want. An easy workaround for now.
>>
>> On 1/23/12 1:21 PM, Klearchos Klearchou wrote:
>>> Pascal,
>>>
>>> I am using FOP 1.0 with:
>>> Batik: 1.7+r608262
>>> xmlgraphics-commons-1.4
>>>
>>> Thank you.
>>>
>>> On 23/1/2012 3:00 PM, Pascal Sancho wrote:
>>>> Klearchos,
>>>>
>>>> I cannot reproduce what you get with the provided snippet: too small.
>>>> What FOP version do you use?
>>>>
>>>> Le 23/01/2012 10:55, Klearchos Klearchou a écrit :
>>>>> Hi Pascal,
>>>>>
>>>>> I copied some of the FO.
>>>>> In case you want to see more please let me know.
>>>>> This FO text is relevant to the image that renders bad (not scaled)
>>>>>
>>>>> ....
>>>>> <fo:block start-indent="10px" font-size="8px" font-family="arial"/>
>>>>> <fo:table width="100%" table-layout="fixed">
>>>>> <fo:table-column column-width="proportional-column-width(1)"/>
>>>>> <fo:table-body>
>>>>> <fo:table-row keep-with-next="always">
>>>>> <fo:table-cell>
>>>>> <fo:block>
>>>>> <fo:external-graphic content-height="scale-to-fit"
>>>>> block-progression-dimension.maximum="90mm" 
>>>>> content-width="scale-to-fit"
>>>>> inline-progression-dimension.maximum="90mm" border="solid 3px #8CE18D"
>>>>> src="c:/tempUnzip\images\image_21952"/>
>>>>> </fo:block>
>>>>> <fo:block space-before="3mm"/>
>>>>> </fo:table-cell>
>>>>> </fo:table-row>
>>>>> ...
>>>>>
>>>>> So in case I haven't described well enough the problem I will try 
>>>>> again:
>>>>> There is a rectangle image  (300 * 300) that overflows out of the 
>>>>> max area.
>>>>> If I change the size of the same image to 310 * 300 or 300 * 310, then
>>>>> the image renders ok.
>>>>>
>>>>> Please let me know if you need more info.
>>>>> Thank you.
>>>>>
>>>>>
>>>>> On 23/1/2012 11:08 AM, Pascal Sancho wrote:
>>>>>> Hi,
>>>>>>
>>>>>> can you provide a short XSL-FO (not XSLT) with equivalent images that
>>>>>> reproduce what you describe here, I cannot figure what you say.
>>>>>>
>>>>>> Le 20/01/2012 16:29, Klearchos Klearchou a écrit :
>>>>>>> Hello Pascal,
>>>>>>>
>>>>>>> the solution that we talked about works well almost in all cases.
>>>>>>> Here is the code:
>>>>>>> <fo:external-graphic src="{$imageLink}" border="solid 3px #8CE18D"
>>>>>>>
>>>>>>> inline-progression-dimension.maximum="{$imageMaxBoundary}"
>>>>>>>                                    content-width="scale-to-fit"
>>>>>>>
>>>>>>> block-progression-dimension.maximum="{$imageMaxBoundary}"
>>>>>>>                                    content-height="scale-to-fit"
>>>>>>>                                />
>>>>>>>
>>>>>>> Now when the image is rectangle the scale does not work.
>>>>>>> I am attaching an image, on the left hand side the image is 310 x 
>>>>>>> 300
>>>>>>> and FOP scales it well.
>>>>>>> On the right hand side is the same image but 300 x 300. As you 
>>>>>>> can see
>>>>>>> FOP fails to scale it.
>>>>>>> It overflows out of the box.
>>>>>>>
>>>>>>> Do you have any idea what it could be?
>>>>>>>
>>>>>>> Thank you in advance
>>>>>>>
>>>>>>>
>>>>>>> On 1/17/2012 5:47 PM, Pascal Sancho wrote:
>>>>>>>> We use imageMagik
>>>>>>>>
>>>>>>>> Le 17/01/2012 15:32, Klearchos Klearchou a écrit :
>>>>>>>>> Pascal,
>>>>>>>>>
>>>>>>>>> the information that you provide are valuable.
>>>>>>>>> Can you propose any open source library in order to manipulate the
>>>>>>>>> quality/resolution of the image?
>>>>>>>>> I tried the imgscalr, getScaledInstance(), Thumbnailator and 
>>>>>>>>> some more
>>>>>>>>> but they do not provide em exactly what I want.
>>>>>>>>> I haven't tried yet JMajick.
>>>>>>>>>
>>>>>>>>> Thanks again.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 1/17/2012 4:18 PM, Pascal Sancho wrote:
>>>>>>>>>> Quality loss may depend on PDF viewer settings and capabilities
>>>>>>>>>>        (anti-aliasing, zoom factor, etc.)
>>>>>>>>>> Also, the result can seem better if you first resample your 
>>>>>>>>>> image before
>>>>>>>>>> using in PDF, to get the best fit on screen reading, but can 
>>>>>>>>>> become
>>>>>>>>>> worse on printing.
>>>>>>>>>>
>>>>>>>>>> Depending on what usages your PDF are for (reading on screen, 
>>>>>>>>>> Laser
>>>>>>>>>> printing, Offset printing, low weight downloading, etc.)
>>>>>>>>>> There is no perfect solution there.
>>>>>>>>>>
>>>>>>>>>> For example, we (my compagny) produce images with different
>>>>>>>>>> quality/resolution for identified purposes, and generate as 
>>>>>>>>>> many PDF files.
>>>>>>>>>>
>>>>>>>>>> The only constant over various resampled images is the real size:
>>>>>>>>>> for instance, a square image (1"x1") will give:
>>>>>>>>>> 96x96, rez 1/96" for screen reading;
>>>>>>>>>> 300x300, rez 1/300" for Laser printing;
>>>>>>>>>> 120x120, rez 1/120" for Dowload _and_print;
>>>>>>>>>> etc.
>>>>>>>>>>
>>>>>>>>>> Le 17/01/2012 14:48, Klearchos Klearchou a écrit :
>>>>>>>>>>> Hi Pascal,
>>>>>>>>>>>
>>>>>>>>>>> yes indeed this was one of my problems.
>>>>>>>>>>> I will test it to see the results.
>>>>>>>>>>>
>>>>>>>>>>> In case I will still have to manipulate the image outside of 
>>>>>>>>>>> the FOP do
>>>>>>>>>>> you have any solution to propose regarding:
>>>>>>>>>>> How to change the print size of the image (like gimp) in 
>>>>>>>>>>> order not to
>>>>>>>>>>> loose image quality and at the same time to show it smaller 
>>>>>>>>>>> inside the PDF.
>>>>>>>>>>>
>>>>>>>>>>> Thank you.
>>>>>>>>>>>
>>>>>>>>>>> On 17/1/2012 3:42 PM, Pascal Sancho wrote:
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> I guess that by "the result is problematic with very tall 
>>>>>>>>>>>> images" you
>>>>>>>>>>>> mean that image can overflow the page when h/w ratio is too 
>>>>>>>>>>>> high.
>>>>>>>>>>>>
>>>>>>>>>>>> If this is the case, you can use "max-height" XSL-FO 
>>>>>>>>>>>> equivalent:
>>>>>>>>>>>>
>>>>>>>>>>>> <fo:external-graphic src="{$imageUrl}"
>>>>>>>>>>>>          
>>>>>>>>>>>> block-progression-dimension.optimum="$my_minimal_height"
>>>>>>>>>>>>          
>>>>>>>>>>>> block-progression-dimension.maximum="$my_maximal_height"
>>>>>>>>>>>>          content-height="scale-to-fit"/>
>>>>>>>>>>>>
>>>>>>>>>>>> Le 17/01/2012 12:17, Klearchos Klearchou a écrit :
>>>>>>>>>>>>> Dear FOP users,
>>>>>>>>>>>>>
>>>>>>>>>>>>> I want to change an image's print size in order to add it 
>>>>>>>>>>>>> inside a PDF.
>>>>>>>>>>>>> I want to do this in order not to loose any quality.
>>>>>>>>>>>>> The image must look smaller inside the PDF but the quality 
>>>>>>>>>>>>> should be the
>>>>>>>>>>>>> same with the original image.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I know that I could do something like this in my XSLT
>>>>>>>>>>>>> (content-width="scale-to-fit"):
>>>>>>>>>>>>>
>>>>>>>>>>>>> <fo:external-graphic src="url('{$imageLink}')"
>>>>>>>>>>>>> content-width="scale-to-fit" border="solid 0.1pt" 
>>>>>>>>>>>>> width="90mm" />
>>>>>>>>>>>>> <fo:block space-before="{$space}"/>
>>>>>>>>>>>>>                                           (<xsl:value-of 
>>>>>>>>>>>>> select="$title"/>)
>>>>>>>>>>>>> <fo:block/>
>>>>>>>>>>>>> <xsl:value-of select="$description"/>
>>>>>>>>>>>>> </fo:block>
>>>>>>>>>>>>>
>>>>>>>>>>>>> but the result is problematic with very tall images.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thus I thought that I should manipulate the image before 
>>>>>>>>>>>>> passing it to FOP.
>>>>>>>>>>>>> I used GIMP and I saw that if I change the print size of 
>>>>>>>>>>>>> the image FOP
>>>>>>>>>>>>> uses this size and the quality of the image is very good.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Anybody knows how to solve this problem?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thank you in advance.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
>>> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org
> 

<<attachment: 300x300.jpg>>

<<attachment: 300x310.jpg>>

<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; xmlns:fo="http://www.w3.org/1999/XSL/Format";>
  <fo:layout-master-set>
    <fo:simple-page-master page-width="210mm" page-height="297mm" master-name="my-page">
      <fo:region-body region-name="main" margin="1.0cm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="my-page">
    <fo:flow flow-name="main">
      <fo:block>different *-p-d.max with square image</fo:block>
      <fo:block>
        <fo:external-graphic src="url(file:///D:/dev/fop/src/fo/300x300.JPG)"
            inline-progression-dimension.maximum="100mm"
            content-width="scale-down-to-fit"
            block-progression-dimension.maximum="50mm"
            content-height="scale-down-to-fit"
            border="solid 5pt red"/>
      </fo:block>
      <fo:block>different *-p-d.max with rectangular image</fo:block>
      <fo:block>
        <fo:external-graphic src="url(file:///D:/dev/fop/src/fo/300x310.JPG)"
            inline-progression-dimension.maximum="100mm"
            content-width="scale-down-to-fit"
            block-progression-dimension.maximum="50mm"
            content-height="scale-down-to-fit"
            border="solid 5pt red"/>
      </fo:block>
      <fo:block>equal *-p-d.max with square image</fo:block>
      <fo:block>
        <fo:external-graphic src="url(file:///D:/dev/fop/src/fo/300x300.JPG)"
            inline-progression-dimension.maximum="50mm"
            content-width="scale-down-to-fit"
            block-progression-dimension.maximum="50mm"
            content-height="scale-down-to-fit"
            border="solid 5pt red"/>
      </fo:block>
      <fo:block>different *-p-d.max with rectangular image</fo:block>
      <fo:block>
        <fo:external-graphic src="url(file:///D:/dev/fop/src/fo/300x310.JPG)"
            inline-progression-dimension.maximum="50mm"
            content-width="scale-down-to-fit"
            block-progression-dimension.maximum="50mm"
            content-height="scale-down-to-fit"
            border="solid 5pt red"/>
      </fo:block>
      <fo:block>text after</fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org

Reply via email to