Forssux Posted December 14, 2017 Posted December 14, 2017 Hi There, My favourite web based map creator (mapbox) changed from using png to svg. Is there a script/function to read 1,2 or 4 pixel based color/form reader and transform this to squares/cirkels? Or is there a way to create this halftone easily Thanks in advance Quote
v_kyr Posted December 14, 2017 Posted December 14, 2017 See for example HalftonePro here. - Though you can also do your own patterns in AD and export them as SVG if needed. Or just build your own patterns directly in SVG code. <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"> <defs> <linearGradient id="Gradient1"> <stop offset="5%" stop-color="white"/> <stop offset="95%" stop-color="green"/> </linearGradient> <linearGradient id="Gradient2" x1="0" x2="0" y1="0" y2="1"> <stop offset="5%" stop-color="black"/> <stop offset="95%" stop-color="green"/> </linearGradient> <pattern id="Pattern" x="0" y="0" width=".15" height=".15"> <rect x="0" y="0" width="20" height="20" fill="green"/> <rect x="0" y="0" width="25" height="25" fill="url(#Gradient2)"/> <circle cx="25" cy="25" r="10" fill="url(#Gradient1)" fill-opacity="0.5"/> </pattern> </defs> <rect fill="url(#Pattern)" stroke="black" width="200" height="200"/> </svg> Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Forssux Posted December 14, 2017 Author Posted December 14, 2017 6 hours ago, v_kyr said: See for example HalftonePro here. - Though you can also do your own patterns in AD and export them as SVG if needed. Or just build your own patterns directly in SVG code. <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"> <defs> <linearGradient id="Gradient1"> <stop offset="5%" stop-color="white"/> <stop offset="95%" stop-color="green"/> </linearGradient> <linearGradient id="Gradient2" x1="0" x2="0" y1="0" y2="1"> <stop offset="5%" stop-color="black"/> <stop offset="95%" stop-color="green"/> </linearGradient> <pattern id="Pattern" x="0" y="0" width=".15" height=".15"> <rect x="0" y="0" width="20" height="20" fill="green"/> <rect x="0" y="0" width="25" height="25" fill="url(#Gradient2)"/> <circle cx="25" cy="25" r="10" fill="url(#Gradient1)" fill-opacity="0.5"/> </pattern> </defs> <rect fill="url(#Pattern)" stroke="black" width="200" height="200"/> </svg> Hi Thank you for the advice, I definitely have a look at the solutions you gave me. The code you wrote didn't open in AD or in mapbox but I could see final result fine in chrome. Pity it didn't resemble the file I included, but I certainly start messing around with the code itself Kind Regards Guy Forssman Quote
v_kyr Posted December 15, 2017 Posted December 15, 2017 Sadly AD doesn't support the full SVG standard, but every browser (Firefox, Chrome etc.) mostly does. You can edit such things online to see immediately the results, see for example JSFiddle or CodePen. <svg xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"> <defs> <pattern id="Pattern" x="0" y="0" width=".15" height=".15"> <rect x="0" y="0" width="5" height="5" fill="#7CBF97"/> <rect x="5" y="0" width="5" height="5" fill="#DEDEDE"/> <rect x="10" y="0" width="5" height="5" fill="#B4D0C2"/> <rect x="15" y="0" width="5" height="5" fill="#7CBF97"/> <rect x="20" y="0" width="5" height="5" fill="#B4D0C2"/> <rect x="0" y="5" width="5" height="5" fill="#B4D0C2"/> <rect x="5" y="5" width="10" height="10" fill="#7CBF97"/> <rect x="15" y="5" width="5" height="5" fill="#B4D0C2"/> <rect x="20" y="5" width="5" height="5" fill="#7CBF97"/> <rect x="25" y="5" width="5" height="5" fill="#B4D0C2"/> <rect x="0" y="10" width="5" height="5" fill="#7CBF97"/> <rect x="5" y="10" width="5" height="5" fill="#DEDEDE"/> <rect x="10" y="10" width="5" height="5" fill="#B4D0C2"/> <rect x="15" y="10" width="5" height="5" fill="#7CBF97"/> <rect x="0" y="15" width="5" height="5" fill="#7CBF97"/> <rect x="5" y="15" width="5" height="5" fill="#B4D0C2"/> <rect x="10" y="15" width="5" height="5" fill="#DEDEDE"/> <rect x="15" y="15" width="5" height="5" fill="#7CBF97"/> <rect x="0" y="20" width="5" height="5" fill="#B4D0C2"/> <rect x="5" y="20" width="10" height="10" fill="#7CBF97"/> <rect x="15" y="20" width="5" height="5" fill="#B4D0C2"/> <rect x="20" y="20" width="5" height="5" fill="#7CBF97"/> <rect x="25" y="20" width="5" height="5" fill="#B4D0C2"/> <rect x="0" y="25" width="5" height="5" fill="#7CBF97"/> <rect x="5" y="25" width="5" height="5" fill="#DEDEDE"/> <rect x="10" y="25" width="5" height="5" fill="#B4D0C2"/> <rect x="15" y="25" width="5" height="5" fill="#7CBF97"/> <rect x="20" y="25" width="5" height="5" fill="#B4D0C2"/> <rect x="20" y="15" width="10" height="10" fill="#7CBF97"/> </pattern> </defs> <rect fill="url(#Pattern)" stroke="black" width="200" height="200"/> </svg> In the above example you would have to adjust rect colors etc. for your pattern so it to comes close to what you might need! Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.