Skip to content
This repository has been archived by the owner on Oct 26, 2023. It is now read-only.

Cannot up-scale small image to fit width #43

Open
nicesw123 opened this issue Dec 19, 2014 · 3 comments
Open

Cannot up-scale small image to fit width #43

nicesw123 opened this issue Dec 19, 2014 · 3 comments

Comments

@nicesw123
Copy link

Hi there!

There's a specific small image small_image.svg, that I'd like to scale-up to fit into the pdf-width.

(The image source of small_image.svg is included right at the bottom for easy copy-pasting)

Here is sample.adoc that you can test with html5, pdf (via asciidoctor-fopub), pdf (via asciidoctor-pdf)
[depends only of small_image.svg, that you can copy-paste from below]

= Test scaling of small image
:toc:

Here comes the image `small_image.svg`:

image::small_image.svg[]

== Scale the image (to make it easier to view)

image::small_image.svg[Small Image, width=1000]

[[small_image]]
[source,asciidoc]
image::small_image.svg[Small Image, width=1000]

=== Good for html5

The <<small_image,above scaled image>> is rendered nicely for html5

=== Bad for asciidoctor-fopub (docbook)

The <<small_image,above scaled image>> is clipped when rendered to pdf via asciidoctor-fopub

.Render to pdf via asciidoctor-fopub (docbook)
[source]
asciidoctor -b docbook -d book -a data-uri! sample.adoc
~/asciidoc/asciidoctor-fopub/fopub sample.xml

=== OK for asciidoctor-pdf (but always maximally scaled)

The `width`-scaling is ignored by asciidoctor-pdf:
there the <<small_image,image>> is always maximally scaled.

.Render to pdf via asciidoctor-pdf
[source]
asciidoctor-pdf sample.adoc

The scaling does not harmonize nicely between html5 and asciidoctor-fopub.

  • What fits nicely in html5, is unfortunately cut-off for pdf output

I believe there should be a possibility to scale to fit the width, but preventing cut-off of an image.

Source of image small_image.svg (for copy-pasting):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->

<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="200"
   height="20"
   id="svg2"
   version="1.1"
   inkscape:version="0.48.5 r10040"
   sodipodi:docname="New document 1">
  <defs
     id="defs4" />
  <sodipodi:namedview
     id="base"
     pagecolor="#ffffff"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="0.0"
     inkscape:pageshadow="2"
     inkscape:zoom="5.6"
     inkscape:cx="103.58874"
     inkscape:cy="-23.239855"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     inkscape:object-paths="true"
     inkscape:object-nodes="true"
     inkscape:snap-global="true"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     inkscape:window-width="1680"
     inkscape:window-height="948"
     inkscape:window-x="0"
     inkscape:window-y="31"
     inkscape:window-maximized="1" />
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(-5.6806582,-850.69528)">
    <g
       id="g3037"
       transform="matrix(0.90352131,0,0,1,3.7342666,-9.1071429)">
      <rect
         y="864.97888"
         x="9.0913725"
         height="4.5456862"
         width="51.731339"
         id="rect2985"
         style="fill:none;stroke:#000000;stroke-width:0.78902733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
      <rect
         y="864.97888"
         x="60.822712"
         height="4.5456862"
         width="51.731339"
         id="rect2985-9"
         style="fill:none;stroke:#000000;stroke-width:0.78902733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
      <rect
         y="864.97888"
         x="112.55405"
         height="4.5456862"
         width="51.731339"
         id="rect2985-96"
         style="fill:none;stroke:#000000;stroke-width:0.78902733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
      <rect
         y="864.97888"
         x="164.28539"
         height="4.5456862"
         width="51.731339"
         id="rect2985-6"
         style="fill:none;stroke:#000000;stroke-width:0.78902733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
    </g>
    <text
       xml:space="preserve"
       style="font-size:4px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
       x="22.841372"
       y="859.5246"
       id="text3088"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3090"
         x="22.841372"
         y="859.5246">small text</tspan></text>
    <text
       xml:space="preserve"
       style="font-size:4px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
       x="71.990654"
       y="859.56769"
       id="text3088-0"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3090-6"
         x="71.990654"
         y="859.56769">small text</tspan></text>
    <text
       xml:space="preserve"
       style="font-size:4px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
       x="119.49065"
       y="859.3891"
       id="text3088-0-8"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3090-6-6"
         x="119.49065"
         y="859.3891">small text</tspan></text>
    <text
       xml:space="preserve"
       style="font-size:4px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
       x="162.8835"
       y="859.56769"
       id="text3088-0-8-8"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3090-6-6-6"
         x="162.8835"
         y="859.56769">small text</tspan></text>
    <g
       id="g3037-0"
       transform="matrix(0.90352131,0,0,1,3.7342666,-4.5614275)">
      <rect
         y="864.97888"
         x="9.0913725"
         height="4.5456862"
         width="51.731339"
         id="rect2985-7"
         style="fill:none;stroke:#000000;stroke-width:0.78902733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
      <rect
         y="864.97888"
         x="60.822712"
         height="4.5456862"
         width="51.731339"
         id="rect2985-9-9"
         style="fill:none;stroke:#000000;stroke-width:0.78902733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
      <rect
         y="864.97888"
         x="112.55405"
         height="4.5456862"
         width="51.731339"
         id="rect2985-96-3"
         style="fill:none;stroke:#000000;stroke-width:0.78902733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
      <rect
         y="864.97888"
         x="164.28539"
         height="4.5456862"
         width="51.731339"
         id="rect2985-6-2"
         style="fill:none;stroke:#000000;stroke-width:0.78902733;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" />
    </g>
    <text
       xml:space="preserve"
       style="font-size:4px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
       x="22.841377"
       y="864.07037"
       id="text3088-3"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3090-4"
         x="22.841377"
         y="864.07037">small text</tspan></text>
    <text
       xml:space="preserve"
       style="font-size:4px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
       x="71.990662"
       y="864.11346"
       id="text3088-0-1"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3090-6-66"
         x="71.990662"
         y="864.11346">small text</tspan></text>
    <text
       xml:space="preserve"
       style="font-size:4px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
       x="119.49067"
       y="863.93488"
       id="text3088-0-8-0"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3090-6-6-8"
         x="119.49067"
         y="863.93488">small text</tspan></text>
    <text
       xml:space="preserve"
       style="font-size:4px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
       x="162.88351"
       y="864.11346"
       id="text3088-0-8-8-4"
       sodipodi:linespacing="125%"><tspan
         sodipodi:role="line"
         id="tspan3090-6-6-6-9"
         x="162.88351"
         y="864.11346">small text</tspan></text>
  </g>
</svg>
@mojavelinux
Copy link
Member

As I mentioned on Twitter, I'm not working on fopub anymore because I'm focusing my attention on Asciidoctor PDF (because I believe it will give us a much better result). However, if someone wants to make a change to correct this issue, I'd be happy to merge it.

@nicesw123
Copy link
Author

I'm focusing my attention on Asciidoctor PDF (because I believe it will give us a much better result).

OK using asciidoctor-pdf is sweet, but there's a lot of work needed still, to satisfy absolutely fundamental stuff (that can be expected from any good documentation system)

  • inclusion of vector-graphics image (currently problematic)
  • harmonization between html5 and pdf backends (e.g. image placement)
  • index (of figures, tables) and cross-reference generation (jump to glossary term)
  • extended syntax-decisions for asciidoctor, to realize certain features.

@mojavelinux
Copy link
Member

Yep, I recognize there is more work to be done. No one said this was easy, but it's the road I've decided to pursue.

Keep in mind this doesn't mean you can't use the DocBook toolchain. It's always an option. I'm just not going to be working in that space. I'm leaving that for other teams so I can advance Asciidoctor and the ecosystem components as quickly as possible. The more I get sidetracked, the longer it take us to get there...and we don't want that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants