image

nishio who knows what they want to do (design skills are not up to par). image nishio image nishio Youā€™ll notice discrepancies in details when you make them and then put them side by sideā€¦ nishio I guess this is how it goes. image nishio Well, Iā€™ll eventually make a Canvas implementation, so thatā€™s about it for nowā€¦ image

nishio ā€œI need to generate an OGP image?ā€ I asked him and he answered ā€œWell, make a sample of step 1ā€ and I got the sample code and ran it and it worked fine.

nishio something like this? image

nishio Iā€™ve made it this far. image

nishio I took my wifeā€™s information design consulting image

nishio I see. image

nishio Iā€™ll compare it to my own design, I knew it was better now.

  • imageimage

nishio I was able to get the text poured in. image nishio SVG to PNG is done, but text laid out with foreignObject is not displayed? image nishio difficult, more to come.

nishio Iā€™m in trouble, I exported SVG from Adobe XD and pasted it into React as JSX I pasted the SVG exported from Adobe XD as JSX to React so that data can be poured in, but word wrap is not done automatically, so I used divs with foreignObjects. But when I render it with Sharp on the server side, the text is not displayed. to be continued nishio So I asked GPT4 if there is any good library to dump foreignObject and carve it into tspan, and they said ā€œno, use this functionā€ or something like that. I tried to use it anyway, but document.createElement doesnā€™t work on the server side. The solution is jsdom. seriously? Are you sure youā€™re not running in the wrong direction? nishio Iā€™ve been going along without worrying because AI is accelerating so fast, but isnā€™t this the path humans should be on? Are you sure about that? I think there was a fork in the road between SVG and Canvas, and a fork between Sharp and Pupettier, but Iā€™ve been trusting them to come up with a solution with full confidence, so Iā€™ve been going forward, but is this really the path to take? nishio image nishio No! Thatā€™s a trap, isnā€™t it? image nishio Wait, in the first place, in this view, I think the appearance of the text in a monospace font and line breaks without considering word breaks or hyphenation is sufficient. I guessā€¦ then there is no need to get the width. In the end, which technology choice is better depends on the unspoken requirement specification of ā€œhow you expect it to look like. nishio Until 5 minutes ago, I was thinking ā€œI canā€™t get the width, so itā€™s impossible to make my own line breaks, Sharp was the wrong choice and Iā€™ll choose Puppeteerā€

from /villagepump/2024/02/07 /villagepump/nishio.icon

  • Maybe the AI assistants are misleading you in a big way.
    • Rendering SVG on the server side is a thorny issue.
    • I canā€™t copy and paste if itā€™s made into an image./villagepump/inajob.icon
    • Since the image seems to be a fixed size, I would put a div with position:absolute or something to overlay the image./villagepump/inajob.icon
    • No, what Iā€™m making now is an OGP Image for SNS, so itā€™s a prerequisite to make it an image./villagepump/nishio.icon
      • I can embed a div in the SVG itself with a foreignObject, but when I try to render it on the server side, it doesnā€™t show up, and Iā€™m wondering if thatā€™s not good enough.
      • Ah, OGP./villagepump/inajob.icon
        • I made my own tool to insert text into images for OGP generationā€¦
        • I wonder what everyone else is doing.
          • Simple things can be done with ImageMagick, but if you start thinking about folding Japanese characters, you will have to make your own.
          • It would be nice to be able to generate PNGs or something from SVG without having to think about it.
          • I believed the AI when it said it could do that, and I was hooked./villagepump/nishio.icon
      • ricapitolarećÆsvgē”Ÿęˆć®ćæ/villagepump/takker.icon
      • /villagepump/yuta0801.iconwrote code to convert svg to png in rust.
    • Itā€™s interesting that talking to GPT4 clarifies a wide variety of misconceptions on this subject.
      • Iā€™d like to sort this out after a break as an interesting story of human cognition.

This page is auto-translated from /nishio/pMAGI-2024-02-06 using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. Iā€™m very happy to spread my thought to non-Japanese readers.