Created
December 11, 2022 13:10
-
-
Save Na0ki/99febee3ac0ac406b8c25ad79db93a99 to your computer and use it in GitHub Desktop.
mikutterサーバーの丼アイコン錬成するのに使ったやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script type="text/javascript" src="https://stuk.github.io/jszip/dist/jszip.js"></script> | |
<script type="text/javascript" src="https://stuk.github.io/jszip/vendor/FileSaver.js"></script> | |
<title>アイコンジェネレータ</title> | |
</head> | |
<body> | |
<div> | |
<a type="button" href="#" id="dlButton" download="icons.zip">ダウンロード</a> | |
</div> | |
<canvas id="canvas" width="1024" height="1024"></canvas> | |
<span style="visibility: hidden" id="app-icon"> | |
<svg width="130" height="130" viewBox="0 0 121 130" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
<rect width="130" height="130" fill="url(#paint0_linear_2_2)" x="-4.5"/> | |
<g filter="url(#filter0_di_2_2)"> | |
<path d="M95.7135 43.6043C94.6199 35.5459 87.5351 29.1953 79.1366 27.9647C77.7196 27.7568 72.351 27 59.9148 27H59.822C47.3824 27 44.7135 27.7568 43.2966 27.9647C35.1319 29.1612 27.6757 34.8675 25.8667 43.0214C24.9966 47.0369 24.9037 51.4888 25.0654 55.5726C25.2958 61.4289 25.3405 67.275 25.877 73.1075C26.2479 76.9817 26.895 80.8251 27.8133 84.6088C29.5329 91.5968 36.4938 97.4122 43.3138 99.7848C50.6155 102.259 58.468 102.67 65.9919 100.971C66.8196 100.78 67.6381 100.559 68.4475 100.306C70.2737 99.7302 72.4164 99.086 73.9915 97.9542C74.0131 97.9384 74.0308 97.9178 74.0433 97.8942C74.0558 97.8706 74.0628 97.8445 74.0637 97.8179V92.1661C74.0634 92.1412 74.0574 92.1167 74.0462 92.0944C74.035 92.0721 74.0189 92.0525 73.9992 92.0371C73.9794 92.0218 73.9564 92.011 73.9318 92.0056C73.9073 92.0002 73.8819 92.0003 73.8574 92.0059C69.0369 93.1472 64.0971 93.7193 59.141 93.7103C50.6118 93.7103 48.3178 89.6981 47.6609 88.0278C47.1329 86.5842 46.7976 85.0784 46.6636 83.5486C46.6622 83.5229 46.667 83.4973 46.6775 83.4738C46.688 83.4502 46.7039 83.4295 46.724 83.4132C46.7441 83.397 46.7678 83.3856 46.7931 83.3801C46.8185 83.3746 46.8448 83.3751 46.8699 83.3816C51.6101 84.5151 56.4693 85.0873 61.3455 85.086C62.5183 85.086 63.6876 85.086 64.8604 85.0553C69.7647 84.919 74.9339 84.6701 79.7591 83.7361C79.8794 83.7123 79.9998 83.6918 80.103 83.6611C87.7139 82.2124 94.9569 77.665 95.6929 66.1501C95.7204 65.6967 95.7892 61.4016 95.7892 60.9312C95.7926 59.3325 96.3085 49.5901 95.7135 43.6043ZM83.9996 72.3371H75.9966V52.9069C75.9966 48.8163 74.277 46.7302 70.7793 46.7302C66.9343 46.7302 65.0083 49.1981 65.0083 54.0727V64.7082H57.0534V54.0727C57.0534 49.1981 55.124 46.7302 51.279 46.7302C47.8019 46.7302 46.0651 48.8163 46.0617 52.9069V72.3371H38.0656V52.3172C38.0656 48.2266 39.1191 44.9769 41.2262 42.568C43.3998 40.1648 46.2509 38.9308 49.7898 38.9308C53.8859 38.9308 56.9812 40.492 59.0447 43.6111L61.036 46.9245L63.0308 43.6111C65.0943 40.492 68.1896 38.9308 72.2788 38.9308C75.8143 38.9308 78.6654 40.1648 80.8459 42.568C82.9529 44.9746 84.0065 48.2243 84.0065 52.3172L83.9996 72.3371Z" fill="#FBFBFB" fill-opacity="0.97"/> | |
</g> | |
<defs> | |
<filter id="filter0_di_2_2" x="21" y="27" width="79" height="83" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> | |
<feFlood flood-opacity="0" result="BackgroundImageFix"/> | |
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> | |
<feOffset dy="4"/> | |
<feGaussianBlur stdDeviation="2"/> | |
<feComposite in2="hardAlpha" operator="out"/> | |
<feColorMatrix type="matrix" values="0 0 0 0 0.261224 0 0 0 0 0 0 0 0 0 0 0 0 0 0.4 0"/> | |
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_2_2"/> | |
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_2_2" result="shape"/> | |
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> | |
<feOffset dy="4"/> | |
<feGaussianBlur stdDeviation="2"/> | |
<feComposite in2="hardAlpha" operator="arithmetic" k2="-1" k3="1"/> | |
<feColorMatrix type="matrix" values="0 0 0 0 0.337255 0 0 0 0 0 0 0 0 0 0.8 0 0 0 0.05 0"/> | |
<feBlend mode="normal" in2="shape" result="effect2_innerShadow_2_2"/> | |
</filter> | |
<linearGradient id="paint0_linear_2_2" x1="61" y1="130" x2="61" y2="-91.5" gradientUnits="userSpaceOnUse"> | |
<stop offset="0.0755157" stop-color="#fc1998"/> | |
<stop offset="0.520094" stop-color="#fc1998"/> | |
</linearGradient> | |
</defs> | |
</svg> | |
</span> | |
<span style="visibility: hidden" id="logo"> | |
<svg width="65" height="65" viewBox="0 0 61 65" fill="none" xmlns="http://www.w3.org/2000/svg"> | |
<path d="M60.7539 14.3904C59.8143 7.40642 53.7273 1.90257 46.5117 0.836066C45.2943 0.655854 40.6819 0 29.9973 0H29.9175C19.2299 0 16.937 0.655854 15.7196 0.836066C8.70488 1.87302 2.29885 6.81852 0.744617 13.8852C-0.00294988 17.3654 -0.0827298 21.2237 0.0561464 24.7629C0.254119 29.8384 0.292531 34.905 0.753482 39.9598C1.07215 43.3175 1.62806 46.6484 2.41704 49.9276C3.89445 55.9839 9.87499 61.0239 15.7344 63.0801C22.0077 65.2244 28.7542 65.5804 35.2184 64.1082C35.9295 63.9428 36.6318 63.7508 37.3252 63.5321C38.8971 63.0329 40.738 62.4745 42.0913 61.4937C42.1099 61.4799 42.1251 61.4621 42.1358 61.4417C42.1466 61.4212 42.1526 61.3986 42.1534 61.3755V56.4773C42.153 56.4557 42.1479 56.4345 42.1383 56.4151C42.1287 56.3958 42.1149 56.3788 42.0979 56.3655C42.0809 56.3522 42.0611 56.3429 42.04 56.3382C42.019 56.3335 41.9971 56.3336 41.9761 56.3384C37.8345 57.3276 33.5905 57.8234 29.3324 57.8156C22.0045 57.8156 20.0336 54.3384 19.4693 52.8908C19.0156 51.6397 18.7275 50.3346 18.6124 49.0088C18.6112 48.9866 18.6153 48.9643 18.6243 48.9439C18.6333 48.9236 18.647 48.9056 18.6643 48.8915C18.6816 48.8774 18.7019 48.8675 18.7237 48.8628C18.7455 48.858 18.7681 48.8585 18.7897 48.8641C22.8622 49.8465 27.037 50.3423 31.2265 50.3412C32.234 50.3412 33.2387 50.3412 34.2463 50.3146C38.4598 50.1964 42.9009 49.9808 47.0465 49.1713C47.1499 49.1506 47.2534 49.1329 47.342 49.1063C53.881 47.8507 60.1038 43.9097 60.7362 33.9301C60.7598 33.5372 60.8189 29.8148 60.8189 29.4071C60.8218 28.0215 61.2651 19.5781 60.7539 14.3904Z" fill="url(#paint0_linear_89_8)"/> | |
<path d="M50.3943 22.237V39.5876H43.5185V22.7481C43.5185 19.2029 42.0411 17.3949 39.036 17.3949C35.7325 17.3949 34.0778 19.5338 34.0778 23.7585V32.9759H27.2434V23.7585C27.2434 19.5338 25.5857 17.3949 22.2822 17.3949C19.2949 17.3949 17.8027 19.2029 17.8027 22.7481V39.5876H10.9298V22.237C10.9298 18.6918 11.835 15.8754 13.6453 13.7877C15.5128 11.7049 17.9623 10.6355 21.0028 10.6355C24.522 10.6355 27.1813 11.9885 28.9542 14.6917L30.665 17.5633L32.3788 14.6917C34.1517 11.9885 36.811 10.6355 40.3243 10.6355C43.3619 10.6355 45.8114 11.7049 47.6847 13.7877C49.4931 15.8734 50.3963 18.6899 50.3943 22.237Z" fill="white"/> | |
<defs> | |
<linearGradient id="paint0_linear_89_8" x1="30.5" y1="0" x2="30.5" y2="65" gradientUnits="userSpaceOnUse"> | |
<stop stop-color="#fc1998"/> | |
<stop offset="1" stop-color="#fc1998"/> | |
</linearGradient> | |
</defs> | |
</svg> | |
</span> | |
<span style="visibility: hidden" id="wordmark"> | |
<svg width="261" height="66" viewBox="0 0 261 66" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<symbol id="logo-symbol-wordmark"><path d="M60.7539 14.4034C59.8143 7.41942 53.7273 1.91557 46.5117 0.849066C45.2943 0.668854 40.6819 0.0130005 29.9973 0.0130005H29.9175C19.2299 0.0130005 16.937 0.668854 15.7196 0.849066C8.70488 1.88602 2.29885 6.83152 0.744617 13.8982C-0.00294988 17.3784 -0.0827298 21.2367 0.0561464 24.7759C0.254119 29.8514 0.292531 34.918 0.753482 39.9728C1.07215 43.3305 1.62806 46.6614 2.41704 49.9406C3.89445 55.9969 9.87499 61.0369 15.7344 63.0931C22.0077 65.2374 28.7542 65.5934 35.2184 64.1212C35.9295 63.9558 36.6318 63.7638 37.3252 63.5451C38.8971 63.0459 40.738 62.4875 42.0913 61.5067C42.1099 61.4929 42.1251 61.4751 42.1358 61.4547C42.1466 61.4342 42.1526 61.4116 42.1534 61.3885V56.4903C42.153 56.4687 42.1479 56.4475 42.1383 56.4281C42.1287 56.4088 42.1149 56.3918 42.0979 56.3785C42.0809 56.3652 42.0611 56.3559 42.04 56.3512C42.019 56.3465 41.9971 56.3466 41.9761 56.3514C37.8345 57.3406 33.5905 57.8364 29.3324 57.8286C22.0045 57.8286 20.0336 54.3514 19.4693 52.9038C19.0156 51.6527 18.7275 50.3476 18.6124 49.0218C18.6112 48.9996 18.6153 48.9773 18.6243 48.9569C18.6333 48.9366 18.647 48.9186 18.6643 48.9045C18.6816 48.8904 18.7019 48.8805 18.7237 48.8758C18.7455 48.871 18.7681 48.8715 18.7897 48.8771C22.8622 49.8595 27.037 50.3553 31.2265 50.3542C32.234 50.3542 33.2387 50.3542 34.2463 50.3276C38.4598 50.2094 42.9009 49.9938 47.0465 49.1843C47.1499 49.1636 47.2534 49.1459 47.342 49.1193C53.881 47.8637 60.1038 43.9227 60.7362 33.9431C60.7598 33.5502 60.8189 29.8278 60.8189 29.4201C60.8218 28.0345 61.2651 19.5911 60.7539 14.4034Z" fill="url(#paint0_linear_89_11)"/> | |
<path d="M12.3442 18.3034C12.3442 16.2668 13.9777 14.6194 15.997 14.6194C18.0163 14.6194 19.6497 16.2668 19.6497 18.3034C19.6497 20.34 18.0163 21.9874 15.997 21.9874C13.9777 21.9874 12.3442 20.34 12.3442 18.3034Z" fill="currentColor"/> | |
<path d="M66.1484 21.4685V38.3839H59.4988V21.9744C59.4988 18.5109 58.0583 16.7597 55.1643 16.7597C51.9746 16.7597 50.3668 18.8482 50.3668 22.9603V31.9499H43.7687V22.9603C43.7687 18.8352 42.1738 16.7597 38.9712 16.7597C36.0901 16.7597 34.6367 18.5109 34.6367 21.9744V38.3839H28V21.4685C28 18.018 28.8746 15.268 30.6238 13.2314C32.4374 11.1948 34.8039 10.157 37.7365 10.157C41.132 10.157 43.7172 11.4802 45.415 14.1135L47.0742 16.9154L48.7334 14.1135C50.4311 11.4802 53.0035 10.157 56.4119 10.157C59.3444 10.157 61.711 11.1948 63.5246 13.2314C65.2738 15.268 66.1484 18.005 66.1484 21.4685ZM89.0297 29.8743C90.4059 28.4085 91.0619 26.5795 91.0619 24.3613C91.0619 22.1431 90.4059 20.3011 89.0297 18.9001C87.7049 17.4343 86.0329 16.7338 84.0007 16.7338C81.9685 16.7338 80.2965 17.4343 78.9717 18.9001C77.6469 20.3011 76.991 22.1431 76.991 24.3613C76.991 26.5795 77.6469 28.4215 78.9717 29.8743C80.2965 31.2753 81.9685 31.9888 84.0007 31.9888C86.0329 31.9888 87.7049 31.2883 89.0297 29.8743ZM91.0619 10.8316H97.6086V37.891H91.0619V34.6999C89.0811 37.3462 86.3416 38.6563 82.7788 38.6563C79.2161 38.6563 76.4765 37.3073 74.0456 34.5442C71.6533 31.7812 70.4443 28.3696 70.4443 24.3743C70.4443 20.3789 71.6661 17.0192 74.0456 14.2561C76.4893 11.4931 79.3833 10.0922 82.7788 10.0922C86.1744 10.0922 89.0811 11.3894 91.0619 14.0356V10.8445V10.8316ZM119.654 23.8683C121.583 25.3342 122.548 27.3837 122.496 29.9781C122.496 32.7411 121.532 34.9075 119.551 36.4122C117.57 37.878 115.178 38.6304 112.284 38.6304C107.049 38.6304 103.499 36.4641 101.621 32.1963L107.306 28.7847C108.065 31.1067 109.737 32.3001 112.284 32.3001C114.625 32.3001 115.782 31.5477 115.782 29.9781C115.782 28.8366 114.265 27.8118 111.165 27.0075C109.995 26.6833 109.03 26.359 108.271 26.0865C107.204 25.6585 106.29 25.1655 105.532 24.5688C103.654 23.103 102.689 21.1572 102.689 18.6666C102.689 16.0203 103.602 13.9059 105.429 12.3882C107.306 10.8186 109.596 10.0662 112.335 10.0662C116.709 10.0662 119.898 11.9601 121.982 15.7998L116.4 19.0428C115.59 17.2008 114.213 16.2798 112.335 16.2798C110.355 16.2798 109.39 17.0321 109.39 18.498C109.39 19.6395 110.908 20.6643 114.008 21.4685C116.4 22.0134 118.278 22.8176 119.641 23.8554L119.654 23.8683ZM140.477 17.538H134.741V28.7977C134.741 30.1468 135.255 30.964 136.22 31.3402C136.927 31.6126 138.355 31.6645 140.49 31.5607V37.891C136.079 38.4358 132.876 37.9948 130.998 36.5419C129.12 35.1409 128.207 32.5336 128.207 28.8106V17.538H123.795V10.8316H128.207V5.37038L134.754 3.25595V10.8316H140.49V17.538H140.477ZM161.352 29.7187C162.677 28.3177 163.333 26.5276 163.333 24.3613C163.333 22.195 162.677 20.4178 161.352 19.0039C160.027 17.6029 158.407 16.8894 156.426 16.8894C154.445 16.8894 152.825 17.5899 151.5 19.0039C150.227 20.4697 149.571 22.2469 149.571 24.3613C149.571 26.4757 150.227 28.2529 151.5 29.7187C152.825 31.1196 154.445 31.8331 156.426 31.8331C158.407 31.8331 160.027 31.1326 161.352 29.7187ZM146.883 34.5313C144.297 31.7682 143.024 28.4215 143.024 24.3613C143.024 20.3011 144.297 17.0062 146.883 14.2432C149.468 11.4802 152.67 10.0792 156.426 10.0792C160.182 10.0792 163.384 11.4802 165.97 14.2432C168.555 17.0062 169.88 20.4178 169.88 24.3613C169.88 28.3047 168.555 31.7682 165.97 34.5313C163.384 37.2943 160.233 38.6434 156.426 38.6434C152.619 38.6434 149.468 37.2943 146.883 34.5313ZM191.771 29.8743C193.095 28.4085 193.751 26.5795 193.751 24.3613C193.751 22.1431 193.095 20.3011 191.771 18.9001C190.446 17.4343 188.774 16.7338 186.742 16.7338C184.709 16.7338 183.037 17.4343 181.661 18.9001C180.336 20.3011 179.68 22.1431 179.68 24.3613C179.68 26.5795 180.336 28.4215 181.661 29.8743C183.037 31.2753 184.761 31.9888 186.742 31.9888C188.722 31.9888 190.446 31.2883 191.771 29.8743ZM193.751 0H200.298V37.891H193.751V34.6999C191.822 37.3462 189.082 38.6563 185.52 38.6563C181.957 38.6563 179.179 37.3073 176.735 34.5442C174.343 31.7812 173.134 28.3696 173.134 24.3743C173.134 20.3789 174.356 17.0192 176.735 14.2561C179.166 11.4931 182.111 10.0922 185.52 10.0922C188.928 10.0922 191.822 11.3894 193.751 14.0356V0.0129719V0ZM223.308 29.7057C224.633 28.3047 225.289 26.5146 225.289 24.3483C225.289 22.182 224.633 20.4048 223.308 18.9909C221.983 17.5899 220.363 16.8765 218.382 16.8765C216.401 16.8765 214.78 17.577 213.456 18.9909C212.182 20.4567 211.526 22.2339 211.526 24.3483C211.526 26.4627 212.182 28.2399 213.456 29.7057C214.78 31.1067 216.401 31.8201 218.382 31.8201C220.363 31.8201 221.983 31.1196 223.308 29.7057ZM208.838 34.5183C206.253 31.7553 204.98 28.4085 204.98 24.3483C204.98 20.2881 206.253 16.9932 208.838 14.2302C211.424 11.4672 214.626 10.0662 218.382 10.0662C222.137 10.0662 225.34 11.4672 227.925 14.2302C230.511 16.9932 231.835 20.4048 231.835 24.3483C231.835 28.2918 230.511 31.7553 227.925 34.5183C225.34 37.2813 222.189 38.6304 218.382 38.6304C214.575 38.6304 211.424 37.2813 208.838 34.5183ZM260.17 21.261V37.878H253.623V22.1301C253.623 20.34 253.173 18.9909 252.247 17.9661C251.385 17.0451 250.164 16.5651 248.594 16.5651C244.89 16.5651 243.012 18.7833 243.012 23.2716V37.878H236.466V10.8316H243.012V13.867C244.581 11.3245 247.077 10.0792 250.575 10.0792C253.366 10.0792 255.656 11.0521 257.431 13.0498C259.257 15.0474 260.17 17.7586 260.17 21.274" fill="currentColor"/> | |
<defs> | |
<linearGradient id="paint0_linear_89_11" x1="30.5" y1="0.0130005" x2="30.5" y2="65.013" gradientUnits="userSpaceOnUse"> | |
<stop stop-color="#fc1998"/> | |
<stop offset="1" stop-color="#fc1998"/> | |
</linearGradient> | |
</defs></symbol><use xlink:href="#logo-symbol-wordmark" style="color:#fff"/> | |
</svg> | |
</span> | |
<script> | |
const androidChromeSizeList = [ | |
36, | |
48, | |
72, | |
96, | |
144, | |
192, | |
256, | |
384, | |
512, | |
]; | |
const appleTouchIconSizeList = [ | |
57, | |
60, | |
72, | |
76, | |
114, | |
120, | |
144, | |
152, | |
167, | |
180, | |
1024, | |
]; | |
const faviconSizeList = [ | |
16, | |
32, | |
48, | |
]; | |
const load_image = (id, width, height) => { | |
if (id === undefined || width === undefined) { | |
throw new Error(`id and width must be specified: id=${id}, width=${width}`); | |
} | |
if (height === undefined) { | |
height = width; | |
} | |
const canvas = document.getElementById("canvas"); | |
canvas.width = width; | |
canvas.height = height; | |
const context = canvas.getContext("2d"); | |
return new Promise(resolve => { | |
const image = new Image(); | |
const span = document.getElementById(id); | |
const svg = new XMLSerializer().serializeToString(span.children.item(0)); | |
image.src = `data:image/svg+xml;charset=utf-8;base64,${btoa(svg)}`; | |
image.onload = () => { | |
context.drawImage(image, 0, 0, width, height); | |
resolve(canvas.toDataURL('image/png').replace(/^data:image\/png;base64,/, '')); | |
}; | |
}); | |
}; | |
const generateAsync = async () => { | |
const zip = new JSZip(); | |
for (const size of androidChromeSizeList) { | |
const filename = `android-chrome-${size}x${size}.png`; | |
try { | |
const image = await load_image('app-icon', size); | |
zip.file(filename, image, {base64: true}); | |
} catch (e) { | |
console.error(`failed to generate ${filename}`, e); | |
} | |
} | |
for (const size of appleTouchIconSizeList) { | |
const filename = `apple-touch-icon-${size}x${size}.png`; | |
try { | |
const image = await load_image('app-icon', size); | |
zip.file(filename, image, {base64: true}); | |
} catch (e) { | |
console.error(`failed to generate ${filename}`, e); | |
} | |
} | |
for (const size of faviconSizeList) { | |
const filename = `favicon-${size}x${size}.png`; | |
try { | |
const image = await load_image('logo', size); | |
zip.file(filename, image, {base64: true}); | |
} catch (e) { | |
console.error(`failed to generate ${filename}`, e); | |
} | |
} | |
{ | |
const filename = 'wordmark.png'; | |
try { | |
const image = await load_image('wordmark', 403, 102); | |
zip.file(filename, image, {base64: true}); | |
} catch (e) { | |
console.error(`failed to generate ${filename}`, e); | |
} | |
} | |
return await zip.generateAsync({type:"blob"}); | |
}; | |
const button = document.getElementById('dlButton'); | |
button.addEventListener('click', (ev) => { | |
ev.preventDefault(); | |
generateAsync().then((content) => { | |
saveAs(content, "icons.zip"); | |
}).catch(console.error); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment