You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by Jörn Kottmann <ko...@gmail.com> on 2010/10/07 14:52:51 UTC

Images in the tools docbook

  Hi all,

I am trying to embed a larger image which is a screen shot
of the Cas Editor window into the Cas Editor
documentation inside the tools docbook.

In the html version the image is too small, and in the pdf versions
its to big. Is there a trick how to scale it nicely in both
versions ?

Here is the piece of xml which embeds the image:
<screenshot>
<mediaobject>
<imageobject>
<imagedata scale="65" format="PNG"
                fileref="&imgroot;CasEditor.png" />
</imageobject>
</mediaobject>
</screenshot>

Jörn

Re: Images in the tools docbook

Posted by Thilo Götz <tw...@gmx.de>.
On 10/7/2010 14:52, Jörn Kottmann wrote:
>  Hi all,
> 
> I am trying to embed a larger image which is a screen shot
> of the Cas Editor window into the Cas Editor
> documentation inside the tools docbook.
> 
> In the html version the image is too small, and in the pdf versions
> its to big. Is there a trick how to scale it nicely in both
> versions ?
> 
> Here is the piece of xml which embeds the image:
> <screenshot>
> <mediaobject>
> <imageobject>
> <imagedata scale="65" format="PNG"
>                fileref="&imgroot;CasEditor.png" />
> </imageobject>
> </mediaobject>
> </screenshot>
> 
> Jörn

I remember having similar issues with the CVD screenshots.
As I recall (this is a while ago), I ended up not scaling
any images because I could never get it to work both in
PDF and HTML.  I would get them in the right size first,
then not use any scaling in DocBook.

HTH,
Thilo

Re: Images in the tools docbook

Posted by Jörn Kottmann <ko...@gmail.com>.
  With the current docbook version it is not possible
to define the image size as scale down to fit.
Scale down to fit either scales the image
down to make it fit or if it fits its shown as it is.
Maybe a stylesheet hack could help here ...

In some cases scaling does not work because
the intrinsic image size is unknown to the
html generator.

I will now just scale my images down to make
them fit on an A4 page. Then they can be displayed
in their intrinsic size in all versions.

Jörn

On 10/11/10 5:36 PM, Jörn Kottmann wrote:
>  Here is a nice link:
> http://www.docbook.org/tdg/en/html/imagedata.html
>
> Depending on the format we have one of the two cases:
> 1. Viewport is larger than the image, image will be rendered
> in its intrinsic size (will look nice)
> 2. Viewport is smaller than the image, image will be clipped
>
> In our formats both cases can occur at the same time,
> usually the html viewport area is larger than the letter
> pdf viewport area.
>
> In my opinion we want the image to be scaled down
> to the (pdf) viewport area if it is larger instead of clipping it.
> And it  should not be scaled up (to html viewport size) if it is smaller,
> then it should be rendered in its intrinsic size.
> But I cannot find a way to specify that.
>
> If that is not possible, we might have to make sure that all images
> are scaled to a size which make them fit into the smallest
> viewport we have.
>
> One reason the scale parameter is behaving so differently
> between pdf and html, might be that the html version
> does not know about the intrinsic image size.
> Marshall, do we use the graphic size extension?
> http://www.sagehill.net/docbookxsl/ImageSizing.html#ImageSizeExt
>
> Jörn
>
> On 10/11/10 3:17 PM, Jörn Kottmann wrote:
>>  On 10/11/10 1:56 PM, Thilo Götz wrote:
>>> On 10/11/2010 13:17, Jörn Kottmann wrote:
>>>>   The images are scaled nicely now in both versions, thanks to 
>>>> Marshalls
>>>> tip to use the width param instead of the scale param.
>>>>
>>>> I scanned trough the pdf and added width="5.7in" to all images
>>> Frankly, I think using absolute numbers as scale parameter
>>> is not a good idea.  For example, our default format for the
>>> PDF docs is "letter", a format that's not used in large parts
>>> of the world.  If you format the docs as A4 so you can properly
>>> print them in your neck of the woods, the page width is different.
>>>
>>> For html, it's usually a good idea not to scale the graphics at
>>> all, if necessary, this can be done by the browser.
>>>
>>
>> Yes that is true, my browser did a good job scaling the images,
>> its just the pdf generator which cannot properly scale the images.
>> The two solutions we found up to now, are using the width
>> parameter or pre-scaling the image itself.
>>
>> Both solutions have the fixed scaling issue. When I optimize with
>> pre-scaling for letter format and the current page layout, then it might
>> not look nice if something changes, e.g. its printed on A4 or additional
>> text is inserted.
>>
>> I will try to experiment with the scalefit parameter, which tries to
>> scale the image as large as possible.
>>
>> Jörn
>


Re: Images in the tools docbook

Posted by Marshall Schor <ms...@schor.com>.
 Hi,

This is something I'm not familiar with.

I ran maven in debug mode on a docbook build to check that the extensions Jar
was included, and found that it appears to be.  This is also evidenced by the
message Failed to load image..., which comes from that jar.

It appears that the relative path for the image files are not being resolved
correctly by this extension.

Googling around, I found in
http://www.sagehill.net/docbookxsl/ModularDoc.html#XIncludeGraphics
some information which would seem to indicate that the main use of these
references is correct.  I'm guessing, however, that the extensions processor has
a bug in that it doesn't take advantage of the relative base to resolve relative
references.

-Marshall

On 10/11/2010 12:38 PM, Jörn Kottmann wrote:
>  On 10/11/10 5:36 PM, Jörn Kottmann wrote:
>> One reason the scale parameter is behaving so differently
>> between pdf and html, might be that the html version
>> does not know about the intrinsic image size.
>> Marshall, do we use the graphic size extension?
>> http://www.sagehill.net/docbookxsl/ImageSizing.html#ImageSizeExt 
>
>
> I tried to enable it with the following params:
> grapicsizeExtension set to 1
> useExtensions set to 1
>
> Now it complains that it cannot load the image
> files:
> ...
> Failed to load image: images/tools/tools.cde/image002.jpg
> Failed to load image: images/tools/tools.cde/image004.jpg
> ...
>
> Not sure what am I missing.
>
> Here is a list of available parameters:
> http://docbkx-tools.sourceforge.net/docbkx-maven-plugin/generate-html-mojo.html#graphicsizeExtension
>
>
> Jörn
>
>

Re: Images in the tools docbook

Posted by Jörn Kottmann <ko...@gmail.com>.
  On 10/11/10 5:36 PM, Jörn Kottmann wrote:
> One reason the scale parameter is behaving so differently
> between pdf and html, might be that the html version
> does not know about the intrinsic image size.
> Marshall, do we use the graphic size extension?
> http://www.sagehill.net/docbookxsl/ImageSizing.html#ImageSizeExt 


I tried to enable it with the following params:
grapicsizeExtension set to 1
useExtensions set to 1

Now it complains that it cannot load the image
files:
...
Failed to load image: images/tools/tools.cde/image002.jpg
Failed to load image: images/tools/tools.cde/image004.jpg
...

Not sure what am I missing.

Here is a list of available parameters:
http://docbkx-tools.sourceforge.net/docbkx-maven-plugin/generate-html-mojo.html#graphicsizeExtension

Jörn

Re: Images in the tools docbook

Posted by Jörn Kottmann <ko...@gmail.com>.
  Here is a nice link:
http://www.docbook.org/tdg/en/html/imagedata.html

Depending on the format we have one of the two cases:
1. Viewport is larger than the image, image will be rendered
in its intrinsic size (will look nice)
2. Viewport is smaller than the image, image will be clipped

In our formats both cases can occur at the same time,
usually the html viewport area is larger than the letter
pdf viewport area.

In my opinion we want the image to be scaled down
to the (pdf) viewport area if it is larger instead of clipping it.
And it  should not be scaled up (to html viewport size) if it is smaller,
then it should be rendered in its intrinsic size.
But I cannot find a way to specify that.

If that is not possible, we might have to make sure that all images
are scaled to a size which make them fit into the smallest
viewport we have.

One reason the scale parameter is behaving so differently
between pdf and html, might be that the html version
does not know about the intrinsic image size.
Marshall, do we use the graphic size extension?
http://www.sagehill.net/docbookxsl/ImageSizing.html#ImageSizeExt

Jörn

On 10/11/10 3:17 PM, Jörn Kottmann wrote:
>  On 10/11/10 1:56 PM, Thilo Götz wrote:
>> On 10/11/2010 13:17, Jörn Kottmann wrote:
>>>   The images are scaled nicely now in both versions, thanks to 
>>> Marshalls
>>> tip to use the width param instead of the scale param.
>>>
>>> I scanned trough the pdf and added width="5.7in" to all images
>> Frankly, I think using absolute numbers as scale parameter
>> is not a good idea.  For example, our default format for the
>> PDF docs is "letter", a format that's not used in large parts
>> of the world.  If you format the docs as A4 so you can properly
>> print them in your neck of the woods, the page width is different.
>>
>> For html, it's usually a good idea not to scale the graphics at
>> all, if necessary, this can be done by the browser.
>>
>
> Yes that is true, my browser did a good job scaling the images,
> its just the pdf generator which cannot properly scale the images.
> The two solutions we found up to now, are using the width
> parameter or pre-scaling the image itself.
>
> Both solutions have the fixed scaling issue. When I optimize with
> pre-scaling for letter format and the current page layout, then it might
> not look nice if something changes, e.g. its printed on A4 or additional
> text is inserted.
>
> I will try to experiment with the scalefit parameter, which tries to
> scale the image as large as possible.
>
> Jörn


Re: Images in the tools docbook

Posted by Jörn Kottmann <ko...@gmail.com>.
  On 10/11/10 1:56 PM, Thilo Götz wrote:
> On 10/11/2010 13:17, Jörn Kottmann wrote:
>>   The images are scaled nicely now in both versions, thanks to Marshalls
>> tip to use the width param instead of the scale param.
>>
>> I scanned trough the pdf and added width="5.7in" to all images
> Frankly, I think using absolute numbers as scale parameter
> is not a good idea.  For example, our default format for the
> PDF docs is "letter", a format that's not used in large parts
> of the world.  If you format the docs as A4 so you can properly
> print them in your neck of the woods, the page width is different.
>
> For html, it's usually a good idea not to scale the graphics at
> all, if necessary, this can be done by the browser.
>

Yes that is true, my browser did a good job scaling the images,
its just the pdf generator which cannot properly scale the images.
The two solutions we found up to now, are using the width
parameter or pre-scaling the image itself.

Both solutions have the fixed scaling issue. When I optimize with
pre-scaling for letter format and the current page layout, then it might
not look nice if something changes, e.g. its printed on A4 or additional
text is inserted.

I will try to experiment with the scalefit parameter, which tries to
scale the image as large as possible.

Jörn

Re: Images in the tools docbook

Posted by Thilo Götz <tw...@gmx.de>.
On 10/11/2010 13:17, Jörn Kottmann wrote:
>  The images are scaled nicely now in both versions, thanks to Marshalls
> tip to use the width param instead of the scale param.
> 
> I scanned trough the pdf and added width="5.7in" to all images

Frankly, I think using absolute numbers as scale parameter
is not a good idea.  For example, our default format for the
PDF docs is "letter", a format that's not used in large parts
of the world.  If you format the docs as A4 so you can properly
print them in your neck of the woods, the page width is different.

For html, it's usually a good idea not to scale the graphics at
all, if necessary, this can be done by the browser.

> which didn't fit on the page. Not sure if that is a robust approach
> because every second (every right page when printed as a book?) page
> is shifted a little to the right. Which means an image on the left page
> can be wider than an image on a right page, trough inserting
> a new page somewhere left pages might become right pages, or
> the content is just shifted down a little.
> 
> Should I then add the with param to all images which are potential
> to wide for a right page ?
> 
> Jörn
> 
> On 10/9/10 12:58 AM, Marshall Schor wrote:
>>   I see that the cde chapter (which has lots of screen shots) uses a
>> width="5.7in" etc. kind of param.  I don't recall if I somehow scaled things
>> first...
>>
>> I do remember having to do some trial and error experimenting to find some
>> approach that worked.  If you get stuck, post again, with a pointer to a sample,
>> and I can have a go at trying to get it to scale properly.
>>
>> -Marshall
>>
>> On 10/7/2010 8:52 AM, Jörn Kottmann wrote:
>>>   Hi all,
>>>
>>> I am trying to embed a larger image which is a screen shot
>>> of the Cas Editor window into the Cas Editor
>>> documentation inside the tools docbook.
>>>
>>> In the html version the image is too small, and in the pdf versions
>>> its to big. Is there a trick how to scale it nicely in both
>>> versions ?
>>>
>>> Here is the piece of xml which embeds the image:
>>> <screenshot>
>>> <mediaobject>
>>> <imageobject>
>>> <imagedata scale="65" format="PNG"
>>>                 fileref="&imgroot;CasEditor.png" />
>>> </imageobject>
>>> </mediaobject>
>>> </screenshot>
>>>
>>> Jörn
>>>
>>>
> 

Re: Images in the tools docbook

Posted by Jörn Kottmann <ko...@gmail.com>.
  The images are scaled nicely now in both versions, thanks to Marshalls
tip to use the width param instead of the scale param.

I scanned trough the pdf and added width="5.7in" to all images
which didn't fit on the page. Not sure if that is a robust approach
because every second (every right page when printed as a book?) page
is shifted a little to the right. Which means an image on the left page
can be wider than an image on a right page, trough inserting
a new page somewhere left pages might become right pages, or
the content is just shifted down a little.

Should I then add the with param to all images which are potential
to wide for a right page ?

Jörn

On 10/9/10 12:58 AM, Marshall Schor wrote:
>   I see that the cde chapter (which has lots of screen shots) uses a
> width="5.7in" etc. kind of param.  I don't recall if I somehow scaled things
> first...
>
> I do remember having to do some trial and error experimenting to find some
> approach that worked.  If you get stuck, post again, with a pointer to a sample,
> and I can have a go at trying to get it to scale properly.
>
> -Marshall
>
> On 10/7/2010 8:52 AM, Jörn Kottmann wrote:
>>   Hi all,
>>
>> I am trying to embed a larger image which is a screen shot
>> of the Cas Editor window into the Cas Editor
>> documentation inside the tools docbook.
>>
>> In the html version the image is too small, and in the pdf versions
>> its to big. Is there a trick how to scale it nicely in both
>> versions ?
>>
>> Here is the piece of xml which embeds the image:
>> <screenshot>
>> <mediaobject>
>> <imageobject>
>> <imagedata scale="65" format="PNG"
>>                 fileref="&imgroot;CasEditor.png" />
>> </imageobject>
>> </mediaobject>
>> </screenshot>
>>
>> Jörn
>>
>>


Re: Images in the tools docbook

Posted by Marshall Schor <ms...@schor.com>.
 I see that the cde chapter (which has lots of screen shots) uses a
width="5.7in" etc. kind of param.  I don't recall if I somehow scaled things
first...

I do remember having to do some trial and error experimenting to find some
approach that worked.  If you get stuck, post again, with a pointer to a sample,
and I can have a go at trying to get it to scale properly.

-Marshall

On 10/7/2010 8:52 AM, Jörn Kottmann wrote:
>  Hi all,
>
> I am trying to embed a larger image which is a screen shot
> of the Cas Editor window into the Cas Editor
> documentation inside the tools docbook.
>
> In the html version the image is too small, and in the pdf versions
> its to big. Is there a trick how to scale it nicely in both
> versions ?
>
> Here is the piece of xml which embeds the image:
> <screenshot>
> <mediaobject>
> <imageobject>
> <imagedata scale="65" format="PNG"
>                fileref="&imgroot;CasEditor.png" />
> </imageobject>
> </mediaobject>
> </screenshot>
>
> Jörn
>
>