Redundant information saved in SVG #135

Closed
opened 2021-12-10 16:22:01 +01:00 by timsat · 0 comments
timsat commented 2021-12-10 16:22:01 +01:00 (Migrated from github.com)

If i'm not missing something then the generated SVG draws white space over a white background, so what the library generates:

        ...
        <rect width="100%" height="100%" style="fill:white"/>
        <rect x="6.400mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="6.600mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/>
        <rect x="6.800mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="7.000mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/>
        <rect x="7.200mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:black;"/>
        <rect x="7.700mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/>
        <rect x="7.900mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="8.100mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:white;"/>
        <rect x="8.600mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="8.800mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/>
        <rect x="9.000mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="9.200mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/>
        <rect x="9.400mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:black;"/>
        <rect x="9.900mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:white;"/>
        ...

would be rendered exactly the same as this (without explicit white stripes in between):

        ...
        <rect width="100%" height="100%" style="fill:white"/>
        <rect x="6.400mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="6.800mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="7.200mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:black;"/>
        <rect x="7.900mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="8.600mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="9.000mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/>
        <rect x="9.400mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:black;"/>
        ...

If my understanding is correct i can submit the MR to optimize SVG output.
Thanks for sharing such a useful project with everybody!

If i'm not missing something then the generated SVG draws white space over a white background, so what the library generates: ```svg ... <rect width="100%" height="100%" style="fill:white"/> <rect x="6.400mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="6.600mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/> <rect x="6.800mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="7.000mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/> <rect x="7.200mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:black;"/> <rect x="7.700mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/> <rect x="7.900mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="8.100mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:white;"/> <rect x="8.600mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="8.800mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/> <rect x="9.000mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="9.200mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:white;"/> <rect x="9.400mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:black;"/> <rect x="9.900mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:white;"/> ... ``` would be rendered exactly the same as this (without explicit white stripes in between): ```svg ... <rect width="100%" height="100%" style="fill:white"/> <rect x="6.400mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="6.800mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="7.200mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:black;"/> <rect x="7.900mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="8.600mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="9.000mm" y="1.000mm" width="0.200mm" height="7.000mm" style="fill:black;"/> <rect x="9.400mm" y="1.000mm" width="0.500mm" height="7.000mm" style="fill:black;"/> ... ``` If my understanding is correct i can submit the MR to optimize SVG output. Thanks for sharing such a useful project with everybody!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
WhyNotHugo/python-barcode#135
No description provided.