[GH-ISSUE #153] SVG optimization #101

Closed
opened 2026-03-03 14:34:34 +03:00 by kerem · 29 comments
Owner

Originally created by @vltr on GitHub (Jan 20, 2016).
Original GitHub issue: https://github.com/lipis/flag-icons/issues/153

Hi! I'm opening an issue, but this is more like an idea. For distribution (bower, etc), I think that the flags could be minimized using tools like SVGO to reduce images, yet maintaining quality. I just made a quick test here and these are the results:

[ flag-icon-css/flags ] $ du -hx --max-depth=1
4.6M    ./1x1
3.6M    ./1x1.min
4.6M    ./4x3
3.7M    ./4x3

Rounding numbers, ~2M can be ripped of in production :)

Hope this helps!

Best regards,
Richard.

Originally created by @vltr on GitHub (Jan 20, 2016). Original GitHub issue: https://github.com/lipis/flag-icons/issues/153 Hi! I'm opening an issue, but this is more like an idea. For distribution (bower, etc), I think that the flags could be minimized using tools like [SVGO](https://github.com/svg/svgo) to reduce images, yet maintaining quality. I just made a quick test here and these are the results: ``` [ flag-icon-css/flags ] $ du -hx --max-depth=1 4.6M ./1x1 3.6M ./1x1.min 4.6M ./4x3 3.7M ./4x3 ``` Rounding numbers, ~2M can be ripped of in production :) Hope this helps! Best regards, Richard.
kerem closed this issue 2026-03-03 14:34:34 +03:00
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

We've been through this before.. and it's an ongoing process that is happening on per flag bases at the moment.. It was breaking a lot of flags when done in bulk..

<!-- gh-comment-id:173186189 --> @lipis commented on GitHub (Jan 20, 2016): We've been through this before.. and it's an ongoing process that is happening on per flag bases at the moment.. It was breaking a lot of flags when done in bulk..
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

https://github.com/lipis/flag-icon-css/issues/63

<!-- gh-comment-id:173186322 --> @lipis commented on GitHub (Jan 20, 2016): https://github.com/lipis/flag-icon-css/issues/63
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

Oh, well, sorry! I didn't searched for it earlier. For me the results were great, but I didn't pass through all flags with a clinical eye :) Cheers!

<!-- gh-comment-id:173188555 --> @vltr commented on GitHub (Jan 20, 2016): Oh, well, sorry! I didn't searched for it earlier. For me the results were great, but I didn't pass through all flags with a clinical eye :) Cheers!
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

Because I guess the Brazilian flag wasn't ruined :) SVGO is more reliable since that time.. so maybe less flags are broken.. but still :)

<!-- gh-comment-id:173189882 --> @lipis commented on GitHub (Jan 20, 2016): Because I guess the Brazilian flag wasn't ruined :) SVGO is more reliable since that time.. so maybe less flags are broken.. but still :)
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

I sense a bit of xenophobia in your comment, but stay cool, I looked at least 10 flags, including Spain, "gb-wls", South Africa, Mexico and others. I really feel sorry for your comment.

<!-- gh-comment-id:173191144 --> @vltr commented on GitHub (Jan 20, 2016): I sense a bit of xenophobia in your comment, but stay cool, I looked at least 10 flags, including Spain, "gb-wls", South Africa, Mexico and others. I really feel sorry for your comment.
Author
Owner

@ilyabreev commented on GitHub (Jan 20, 2016):

Maybe it'll be better to add grunt task that optimizes svgs and puts them to separate folder.
Original flags won't get hurt in that case. And if anyone find ruined flag, we will submit an issue to svgo.

<!-- gh-comment-id:173191925 --> @ilyabreev commented on GitHub (Jan 20, 2016): Maybe it'll be better to add grunt task that optimizes svgs and puts them to separate folder. Original flags won't get hurt in that case. And if anyone find ruined flag, we will submit an issue to svgo.
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

Thanks @ilyabreev, that's a more constructive idea, but, as the course of this issue goes, it's better for me to unstar the project, use a gif / png version I already have and wave good luck for a project that's in a social network with a xenophobic author. That doesn't seems right.

<!-- gh-comment-id:173193088 --> @vltr commented on GitHub (Jan 20, 2016): Thanks @ilyabreev, that's a more constructive idea, but, as the course of this issue goes, it's better for me to unstar the project, use a gif / png version I already have and wave good luck for a project that's in a social network with a xenophobic author. That doesn't seems right.
Author
Owner

@ilyabreev commented on GitHub (Jan 20, 2016):

Relax man. We are all friends, no matter where are we from.
It is just a joke, I think. Don't let it stick to your heart so hard!

<!-- gh-comment-id:173194955 --> @ilyabreev commented on GitHub (Jan 20, 2016): Relax man. We are all friends, no matter where are we from. It is just a joke, I think. Don't let it stick to your heart so hard!
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

@vltr The written text many times can be misunderstood.. But xenophobia is one of the last things that could characterise me :) Why do you think I insulted you in any way? (Plus I love Brazil)

<!-- gh-comment-id:173195030 --> @lipis commented on GitHub (Jan 20, 2016): @vltr The written text many times can be misunderstood.. But xenophobia is one of the last things that could characterise me :) Why do you think I insulted you in any way? (Plus I love Brazil)
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

@ilyabreev I'm relaxed :)

@lipis You insulted me by making assumptions, either I'm brazilian or not. If you chose the brazilian flag as an example of success of SVGO, directly, it's probably because this happened before. I repeat, PROBABLY. In any case: a very unfortunate example to give.

<!-- gh-comment-id:173196100 --> @vltr commented on GitHub (Jan 20, 2016): @ilyabreev I'm relaxed :) @lipis You insulted me by making assumptions, either I'm brazilian or not. If you chose the brazilian flag as an example of success of SVGO, directly, it's **probably** because this happened before. I repeat, PROBABLY. In any case: a very unfortunate example to give.
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

@vltr LOL :) It's hard to notice if any of the flags are broken after an optimization.. especially if you don't know how the flags should be.. but we (humans) tend to notice familiar things.. and I (wrongly maybe) assumed that you are a Brazilian or at least know how the Brazilian flag looks like since it's written on your profile.. so if the SVGO would break it (like in ruining the XML of it) you would quickly notice it and you wouldn't suggest to optimize all the flags.. That's all I meant..

(I'm still puzzled on how you got insulted.. but that's Internet I guess)

<!-- gh-comment-id:173196970 --> @lipis commented on GitHub (Jan 20, 2016): @vltr LOL :) It's hard to notice if any of the flags are broken after an optimization.. especially if you don't know how the flags should be.. but we (humans) tend to notice familiar things.. and I (wrongly maybe) assumed that you are a Brazilian or at least know how the Brazilian flag looks like since it's written on your profile.. so if the SVGO would break it (like in ruining the XML of it) you would quickly notice it and you wouldn't suggest to optimize all the flags.. That's all I meant.. (I'm still puzzled on how you got insulted.. but that's Internet I guess)
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

@lipis The insult is in your own words:

.. and I (wrongly maybe) assumed that you are a Brazilian or at least know how the Brazilian flag looks like since it's written on your profile..

Do you always makes this assumption, that all people will look only their flag and absolutely forget that this project have all flags?

<!-- gh-comment-id:173198227 --> @vltr commented on GitHub (Jan 20, 2016): @lipis The insult is in your own words: > .. and I (wrongly maybe) assumed that you are a Brazilian or at least know how the Brazilian flag looks like since it's written on your profile.. Do you always makes this assumption, that all people will look **only their flag** and absolutely forget that this project have **all** flags?
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

Fact: Some flags will be ruined if running the SVGO and ripping 2MB from all the flags..!
Fact: You assumed that everything will be OK with all the flags..
Fact: People tend to not like if their flag is ruined.. :)

Question: Did you check any of the flags after running the SVGO?! If so.. which ones did you check?!

<!-- gh-comment-id:173199285 --> @lipis commented on GitHub (Jan 20, 2016): Fact: Some flags will be ruined if running the SVGO and ripping 2MB from all the flags..! Fact: You assumed that everything will be OK with all the flags.. Fact: People tend to not like if their flag is ruined.. :) Question: Did you check any of the flags after running the SVGO?! If so.. which ones did you check?!
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

Agreed about all facts. And, about your question, the answer is in the third comment after you closed this issue. Perhaps if you named another flag, this could have passed in blank, I'll not deny that because I'm no hypocrite. But, in a second thought, the behavior itself it's wrong. It's valid to anyone.

<!-- gh-comment-id:173200649 --> @vltr commented on GitHub (Jan 20, 2016): Agreed about all facts. And, about your question, [the answer is in the third comment](https://github.com/lipis/flag-icon-css/issues/153#issuecomment-173191144) after you closed this issue. Perhaps if you named another flag, this could have passed in blank, I'll not deny that because I'm no hypocrite. But, in a second thought, the behavior itself it's wrong. It's valid to anyone.
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

So you are not a Brazilian or you don't live in Brazil and calling you a Brazilian is an insult to humanity?

<!-- gh-comment-id:173201337 --> @lipis commented on GitHub (Jan 20, 2016): So you are not a Brazilian or you don't live in Brazil and calling you a Brazilian is an insult to humanity?
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

(Even though I didn't call you a Brazilian I just assumed that you will know how the Brazilian flag looks like)

<!-- gh-comment-id:173201634 --> @lipis commented on GitHub (Jan 20, 2016): (Even though I didn't call you a Brazilian I just assumed that you will know how the Brazilian flag looks like)
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

No, you didn't understand a bit what I'm talking about. You simply presume that someone will only look at the flag of his country (and not the rest) based on his profile. That's the bottom line.

<!-- gh-comment-id:173202478 --> @vltr commented on GitHub (Jan 20, 2016): No, you didn't understand a bit what I'm talking about. You simply presume that someone will only look at the flag of his country (and not the rest) based on his profile. That's the bottom line.
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

You're a funny guy..

<!-- gh-comment-id:173202703 --> @lipis commented on GitHub (Jan 20, 2016): You're a funny guy..
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

(I assume that you are a guy.. because of the Richard and it's most common for men population)

<!-- gh-comment-id:173202855 --> @lipis commented on GitHub (Jan 20, 2016): (I assume that you are a guy.. because of the Richard and it's most common for men population)
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

I'm just polite and dislike controversial assumptions of any kind, specially from the author of a project I was keen to use (and help). I just feel sorry for you.

<!-- gh-comment-id:173203648 --> @vltr commented on GitHub (Jan 20, 2016): I'm just polite and dislike controversial assumptions of any kind, specially from the author of a project I was keen to use (and help). I just feel sorry for you.
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

Please don't feel sorry.. I'm fine :) But I could also be insulted when someone is calling me xenophobic assuming that I am :) That's not very polite in my book...

<!-- gh-comment-id:173205287 --> @lipis commented on GitHub (Jan 20, 2016): Please don't feel sorry.. I'm fine :) But I could also be insulted when someone is calling me xenophobic assuming that I am :) That's not very polite in my book...
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

We're settled then :) Cheers!

<!-- gh-comment-id:173206277 --> @vltr commented on GitHub (Jan 20, 2016): We're settled then :) Cheers!
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

You can still use the flags.. they are not mine :)

<!-- gh-comment-id:173206798 --> @lipis commented on GitHub (Jan 20, 2016): You can still use the flags.. they are not mine :)
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

But the project is and the course taken was not pleasant, unfortunately.

<!-- gh-comment-id:173208583 --> @vltr commented on GitHub (Jan 20, 2016): But the project is and the course taken was not pleasant, unfortunately.
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

I won't tell anyone..

<!-- gh-comment-id:173208868 --> @lipis commented on GitHub (Jan 20, 2016): I won't tell anyone..
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

Neither I. But here's something for the future releases: unit tests, based on high-res flags (originals) and renders of the SVG flags on PhantomJS (or any other engine), with pixel subtraction and a bias level of acceptance (since not every anti-aliasing algorythm is equal, IMHO).

<!-- gh-comment-id:173211037 --> @vltr commented on GitHub (Jan 20, 2016): Neither I. But here's something for the future releases: unit tests, based on high-res flags (originals) and renders of the SVG flags on PhantomJS (or any other engine), with pixel subtraction and a bias level of acceptance (since not every anti-aliasing algorythm is equal, IMHO).
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

If these flags were my main job.. yes :) Otherwise reasonable PRs are always welcome..

<!-- gh-comment-id:173212255 --> @lipis commented on GitHub (Jan 20, 2016): If these flags were my main job.. yes :) Otherwise reasonable PRs are always welcome..
Author
Owner

@vltr commented on GitHub (Jan 20, 2016):

Oh ... Well, it was my time to make the wrong presumption then, but I'll keep it to myself. Cheers!

<!-- gh-comment-id:173219753 --> @vltr commented on GitHub (Jan 20, 2016): Oh ... Well, it was my time to make the wrong presumption then, but I'll keep it to myself. Cheers!
Author
Owner

@lipis commented on GitHub (Jan 20, 2016):

Roger out..

<!-- gh-comment-id:173220525 --> @lipis commented on GitHub (Jan 20, 2016): Roger out..
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
starred/flag-icons#101
No description provided.