[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [docbook-apps] imagedata scale problem
Hi Bob. That's an answer :) (I must say I have tried to find "432" in the stylesheets without success !) I will have a look at the article and report back. Thanks a lot for your explanations. Best regards, Fabien -----Message d'origine----- De : Bob Stayton [mailto:bobs@sagehill.net] Envoyé : jeudi 4 août 2011 17:55 À : Fabien Tillier; docbook-apps@lists.oasis-open.org Objet : Re: [docbook-apps] imagedata scale problem Hi Fabien, The basic problem is that the HTML img element does not let you specify a percentage scale of an image's intrinsic size. The width attribute on img can be either as pixels (and a plain integer is interpreted as pixels), or as percentage. But the img percentage is of the page width (window width in a browser), so the image would be scaled to take up 80% of the window width, not 80% of each image's intrinsic image size. Thus all images would be the same size if the stylesheet just passed 80% to the img width attribute. This leaves scaling the intrinsic image size up to the XSLT processor. The problem in XSLT processing is figuring out what the intrinsic image width is so that a scale="80" can be applied. Without the intrinsic image width, the processor has to guess. It does so by using the 'nominal.image.width' stylesheet param, which is set to 6 times the 'pixels.per.inch' param, which is set to 90 by default. Thus the nominal.image.width value is 540, and 80% of that is 432, which is what you see in your output. For the stylesheet to get the intrinsic image size, Norm Walsh wrote an Java extension program that opens the graphic and determines its size (if it can). Then it uses that information to scale the graphic. That extension is included in the DocBook XSL distribution and is described here: http://www.sagehill.net/docbookxsl/ImageSizing.html#ImageSizeExt It does require using a Java XSLT processor such as Saxon or Xalan. It will not work with xsltproc. Bob Stayton Sagehill Enterprises bobs@sagehill.net ----- Original Message ----- From: "Fabien Tillier" <f.tillier@cerep.fr> To: <docbook-apps@lists.oasis-open.org> Sent: Thursday, August 04, 2011 12:51 AM Subject: [docbook-apps] imagedata scale problem Hi List. I have some troubles when rendering images specified as <equation> <title>Mitochondrial Membrane Potential</title> <alt/> <mediaobject> <imageobject> <imagedata role="analysis" fileref="/images/xml/53_2.png" scale="80" format="PNG"/> </imageobject> </mediaobject> </equation> When using the HTML DB5 stylesheet, the result for the image is <div class="equation-contents"> <div class="mediaobject"> <img width="432" src="/images/xml/53_2.png"> </div> </div> My images all have the same resolution, thus different size but uniform display appearance of the equation they contains. As they are a bit too big, I use scale=80" to reduce their size by 20%. My problem is that the result gives for all images an <img width="432"...> whatever the intrinsic image size is. Thus my equations appears now all with different display sizes on the HTML page, which is not the expected output. As a hint, when using xsl-fo output, I get <fo:block id="d68e38942"> <fo:external-graphic src="url(/images/xml/53_2.png)" width="auto" height="auto" content-width="80%" content-height="80%" content-type="content-type:image/png"/> </fo:block> Which is correct. Any ideas ? Regards, Fabien --------------------------------------------------------------------- To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]