NATION

PASSWORD

Flag issues while trying to convert to SVG

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Abomn
Political Columnist
 
Posts: 5
Founded: Dec 09, 2020
Iron Fist Consumerists

Flag issues while trying to convert to SVG

Postby Abomn » Sun Dec 08, 2024 11:40 am

Hello anyone who reads this.
I've currently never used SVG before but figured I'd have a go at trying to make a flag using SVG while I was in the midst of updating my flag.
I used a free online SVG creation service (Unfortunately I can't remember what it was called at the time, if it's deemed as important), and then used an advised compression service: https://jakearchibald.github.io/svgomg/
The issue is even having made various attempts at optimising the SVG and trying to figure out what the system deems as "advanced features", I can't get NationStates to accept this new flag.
If anyone could be of help I would greatly appreciate it.

The current SVG code for the flag after running it through the compressor is this.
Code: Select all
<svg xmlns="http://www.w3.org/2000/svg" width="1750" height="1125"><path fill="#fff" d="M0 0h1750v1125H0z"/><path d="M375 0h1000v1125H375z"/><path fill="maroon" d="M1450 0h300v1125h-300zM0 0h300v1125H0z"/><g stroke="#5e0000" stroke-linecap="null" stroke-linejoin="null" stroke-width="14.767"><path fill="#950000" d="m481.224 562.507 145.822-145.823v72.911h58.465V373.011h116.584v-58.464h-72.911l145.822-145.823 145.823 145.823h-72.911v58.464h116.596v116.584h58.464v-72.91l145.823 145.822-145.823 145.822v-72.911h-58.464v116.596H947.918v58.465h72.91L875.007 956.3 729.184 810.48h72.911v-58.465H685.511V635.418h-58.465v72.911z"/><path fill="#811414" d="m780.252 562.507-72.91-72.912v36.45h-29.24V365.603h160.443v29.238h-36.45l72.911 72.912 72.912-72.912h-36.45v-29.238h160.442v160.442h-29.239v-36.45l-72.91 72.912 72.91 72.91v-36.449h29.239V759.41H911.468v-29.238h36.45l-72.912-72.911-72.911 72.91h36.45v29.24H678.103V598.967h29.238v36.45l72.911-72.911z"/></g><circle cx="875" cy="562.5" r="100" fill="#5e0000" stroke="#000" stroke-linecap="null" stroke-linejoin="null" stroke-width="15"/><ellipse cx="875" cy="562.5" fill="#f49b9b" rx="30" ry="93"/></svg>


The output flag should look like this, for comparison (sorry if the image is too large).
Image

User avatar
Refuge Isle
Technical Moderator
 
Posts: 2568
Founded: Dec 14, 2018
Left-wing Utopia

Postby Refuge Isle » Sun Dec 08, 2024 3:49 pm

As you may know, SVGs are not like other image files. They don't have the exact pixel information that will present the picture, but rather contain a series of instructions that draws the picture from scratch at whatever resolution is requested. In this way, they can be used as conduits for malicious script execution. The best I can say is that your file failed our library's check of whether it's a benign file or trying to do something else. If you're using a script to translate an image to a series of vectors, there's a far greater likelihood of it failing our SVG check than if you had drawn the image yourself or gotten it from someone else who did it by hand.

That said, I had a few minutes today, and your design looked simple enough, so I have recreated something similar to your flag in inkscape this morning and you're free to use that version if it looks alright on your end.

[Permanent link to file]

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

<svg
   width="1750"
   height="1125"
   viewBox="0 0 1750 1125"
   version="1.1"
   id="svg1"
   xml:space="preserve"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg"><defs
     id="defs1" /><g
     id="layer1"><rect
       style="display:inline;fill:#800000;fill-opacity:1;stroke-width:1.37953;stroke-opacity:0.432937"
       id="rect1"
       width="1750"
       height="1125"
       x="0"
       y="0" /><rect
       style="display:inline;fill:#ffffff;fill-opacity:1;stroke-width:1.37681;stroke-opacity:0.432937"
       id="rect2"
       width="1150.0697"
       height="1125"
       x="299.96515"
       y="0" /><rect
       style="display:inline;fill:#000000;fill-opacity:1;stroke-width:1.37821;stroke-opacity:0.432937"
       id="rect3"
       width="1000.1872"
       height="1125"
       x="374.9064"
       y="0" /><rect
       style="display:inline;fill:#811414;fill-opacity:1;stroke:#5e0000;stroke-width:15;stroke-dasharray:none;stroke-opacity:1"
       id="rect4"
       width="392.40628"
       height="392.40628"
       x="678.79688"
       y="366.29688" /><path
       style="display:inline;fill:#950000;fill-opacity:1;stroke:#5e0000;stroke-width:14.3422;stroke-dasharray:none;stroke-opacity:1"
       d="m 839.28873,758.70316 h -37.31504 v 50.88968 H 728.2462 l 146.8979,145.76247 146.611,-145.49335 h -74.0144 v -51.1588 h -36.74121 v -29.69002 l 37.61024,0.28791 -73.17871,-71.52509 -73.03133,70.5228 h 36.89801 c -0.0188,15.69538 -0.008,14.70879 -0.008,30.4044 z"
       id="path11" /><path
       style="display:inline;fill:#950000;fill-opacity:1;stroke:#5e0000;stroke-width:14.3422;stroke-dasharray:none;stroke-opacity:1"
       d="m 1071.6736,598.3427 v 37.31504 h 50.8897 v 73.72749 l 145.7624,-146.8979 -145.4933,-146.61101 v 74.01441 h -51.1588 v 36.74121 h -29.69 l 0.2879,-37.61024 -71.52516,73.17871 70.52286,73.03133 v -36.89801 c 15.6954,0.0188 14.7088,0.008 30.4044,0.008 z"
       id="path6" /><path
       style="display:inline;fill:#950000;fill-opacity:1;stroke:#5e0000;stroke-width:14.3422;stroke-dasharray:none;stroke-opacity:1"
       d="m 678.79687,598.3427 v 37.31504 h -50.88969 v 73.72749 L 482.14472,562.48733 627.63807,415.87632 v 74.01441 h 51.1588 v 36.74121 h 29.69001 l -0.2879,-37.61024 71.52509,73.17871 -70.5228,73.03133 v -36.89801 c -15.69539,0.0188 -14.70879,0.008 -30.4044,0.008 z"
       id="path9" /><path
       style="display:inline;fill:#950000;fill-opacity:1;stroke:#5e0000;stroke-width:14.3422;stroke-dasharray:none;stroke-opacity:1"
       d="M 839.28873,366.29687 H 801.97369 V 315.40719 H 728.2462 l 146.8979,-145.76247 146.611,145.49335 h -74.0144 v 51.1588 h -36.74121 v 29.69002 l 37.61024,-0.28791 -73.17871,71.52509 -73.03133,-70.5228 h 36.89801 c -0.0188,-15.69538 -0.008,-14.70879 -0.008,-30.4044 z"
       id="path10" /><path
       style="display:inline;fill:#5e0000;fill-opacity:1;stroke:#000000;stroke-width:15.0969;stroke-dasharray:none;stroke-opacity:1"
       id="path4"
       d="M 974.12851,562.33059 A 99.128647,100.30025 0 0 1 875.16845,662.8001 99.128647,100.30025 0 0 1 775.8715,562.67148 a 99.128647,100.30025 0 0 1 98.958,-100.47158 99.128647,100.30025 0 0 1 99.299,100.12655" /><path
       style="display:inline;fill:#f49b9b;fill-opacity:1;stroke:none;stroke-width:0;stroke-dasharray:none;stroke-opacity:1"
       id="path5"
       d="m 904.85631,562.26887 a 29.856352,92.720352 0 0 1 -29.80557,92.87682 29.856352,92.720352 0 0 1 -29.90705,-92.56169 29.856352,92.720352 0 0 1 29.80496,-92.87874 29.856352,92.720352 0 0 1 29.90766,92.55978" /></g></svg>

User avatar
Mechanocracy
Spokesperson
 
Posts: 166
Founded: Jun 12, 2022
Psychotic Dictatorship

Postby Mechanocracy » Sun Dec 08, 2024 10:07 pm

Abomn wrote:Hello anyone who reads this.
I've currently never used SVG before but figured I'd have a go at trying to make a flag using SVG while I was in the midst of updating my flag.
I used a free online SVG creation service (Unfortunately I can't remember what it was called at the time, if it's deemed as important), and then used an advised compression service: https://jakearchibald.github.io/svgomg/
The issue is even having made various attempts at optimising the SVG and trying to figure out what the system deems as "advanced features", I can't get NationStates to accept this new flag.
If anyone could be of help I would greatly appreciate it.

For your circle code and the code generating the big ol' weird arrowpolygon thingy, NS's SVG parser really doesn't like these properties in particular:
Code: Select all
stroke-linecap="null"

Code: Select all
stroke-linejoin="null"

Removing those from the code makes it work
Robotic Delegate of Concord, Regional Reptile of The League, Citizen of the Republic for which both stand.
░░░░▒▒▒▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒░░░░

User avatar
Trotterdam
Postmaster-General
 
Posts: 10745
Founded: Jan 12, 2012
Left-Leaning College State

Postby Trotterdam » Sun Dec 08, 2024 10:36 pm

According to the SVG specification, valid values for "stroke-linecap" are "butt", "round", and "square", and valid values for "stroke-linejoin" are "miter", "round", and "bevel". So "null" is indeed an invalid value. Whichever software outputted that is bugged.

Based on the PNG version of your flag, it's clear that your "stroke-linejoin" should be "miter" (which can be safely omitted, because it's the default value). I don't think that "stroke-linecap" matters because all your lines are closed loops. So yes, just delete those parameters.

User avatar
National Coraland of Fishery
Envoy
 
Posts: 226
Founded: Nov 12, 2022
Democratic Socialists

Postby National Coraland of Fishery » Sun Dec 08, 2024 10:38 pm

Abomn wrote:-snip-

Similar issues with my coloring, I used this code and it worked
Code: Select all
<svg xmlns="http://www.w3.org/2000/svg" width="1750" height="1125">
  <rect fill="#fff" x="0" y="0" width="1750" height="1125" />
  <rect fill="#000" x="375" y="0" width="1000" height="1125" />
  <rect fill="maroon" x="1450" y="0" width="300" height="1125" />
  <rect fill="maroon" x="0" y="0" width="300" height="1125" />
  <g stroke="#5e0000" stroke-linecap="round" stroke-linejoin="round" stroke-width="14.767">
    <path fill="#950000" d="M481.224 562.507l145.822-145.823v72.911h58.465V373.011h116.584v-58.464h-72.911L874.684 168.724 1020.507 314.547h-72.911v58.464h116.596v116.584h58.464v-72.91l145.823 145.822-145.823 145.822v-72.911h-58.464v116.596H947.918v58.465h72.91L875.007 956.3 729.184 810.48h72.911v-58.465H685.511V635.418h-58.465v72.911z" />
    <path fill="#811414" d="M780.252 562.507l-72.91-72.912v36.45h-29.24V365.603h160.443v29.238h-36.45l72.911 72.912 72.912-72.912h-36.45v-29.238h160.442v160.442h-29.239v-36.45l-72.91 72.912 72.91 72.91v-36.449h29.239V759.41H911.468v-29.238h36.45l-72.912-72.911-72.911 72.91h36.45v29.24H678.103V598.967h29.238v36.45l72.911-72.911z" />
  </g>
  <circle cx="875" cy="562.5" r="100" fill="#5e0000" stroke="#000" stroke-width="15" />
  <ellipse cx="875" cy="562.5" fill="#f49b9b" rx="30" ry="93" />
</svg>
Last edited by National Coraland of Fishery on Sun Dec 08, 2024 10:39 pm, edited 1 time in total.
The Island Paradise and Aquarium Zoo of Fishery
"When the sun comes up...I couldn't tell where heaven stopped and the Earth began."
Current Parliament Member and Citizen of The Region That Has No Big Banks, Former Lt Gov of Covenant Shores, Former Founder and Sec of Law of The Global Union Consr, Former Vice President of Gravy

User avatar
Abomn
Political Columnist
 
Posts: 5
Founded: Dec 09, 2020
Iron Fist Consumerists

Postby Abomn » Wed Dec 11, 2024 11:36 am

I'd like to thank everyone for the helpful replies! I've managed to get it working now thanks to the first reply's version of the flag file and I'd like to give them credit for that.
I'll also take the advice others have left here to be mindful in the future so the same issue doesn't happen again.
Once again thank you all so much.


Return to Technical

Who is online

Users browsing this forum: Shrikisthan

Advertisement

Remove ads