6 ms·
That is not clever. That is horrifying. You have just massively bloated your set of dependencies to accomplish something you could have done with a rudimentary
by salawat 5y ago
That is not clever. That is horrifying.
You have just massively bloated your set of dependencies to accomplish something you could have done with a rudimentary GUI toolkit.
- rfrankenstein 5y ago“Premature optimization is the root of all evil”—Donald Knuth.
- emsy 5y agoThat phrase is so overused in light of massively over engineered solutions that are created every day in our industry . Let’s face it: this project loads some data via http and displays some text and primitives on a display. This can easily be handled on a esp32 with room to spare. But somehow we think it’s normal to involve an OS, a fully fledged computer and a browser to do this. Seriously, we need the opposite of the Knuth quote: “When in doubt don’t ship a browser” or something like that.
- TedDoesntTalk 5y agoI wonder what the reason is for this solution. He must have one.
- edoceo 5y agoCause EInk display code works nice to just ship it an image type file. So, it's gotta be rasterized before, using Chromium makes that super easy - rather than hand crafting PNG. I personally make SVG then rasterize but this isn't that terrible.
- jazzyjackson 5y agoI was going down this route once, trying to use Inkscape headless. Is there a SVG-2-bitmap tool you can recommend?
- edoceo 5y agoImagemagick. Does everything.
- deleted 5y ago[deleted]
- jazzyjackson 5y agoSomehow I missed that ImageMagick reads SVG, that is a much shorter dependency stack than selenium! Thanks
- vbezhenar 5y agoCheck out https://github.com/RazrFalcon/resvg https://github.com/RazrFalcon/resvg
- mkl 5y agoAnother one is rsvg: https://www.tutorialspoint.com/unix_commands/rsvg.htm https://www.tutorialspoint.com/unix_commands/rsvg.htm
- kevinsundar 5y agoHis GitHub says this: "This might sound like a convoluted way to generate the calendar, but I'm doing so mainly because (i) it's easier to format the calendar exactly the way I want it using HTML/CSS, and (ii) I can better delink the generation of the calendar and refreshing of the eInk display. In the future, I might choose to generate the calendar on a separate RPi device, while using a ESP32 or PiZero purely to just retrieve the image from a file host and update the screen." https://github.com/speedyg0nz/MagInkCal/blob/main/render/render.py https://github.com/speedyg0nz/MagInkCal/blob/main/render/ren... Its easy to design something nice looking in html and css and compute is cheap. Seems like a fine solution to me. Maybe even better since you can push the image generation somewhere else and just have the RPI update the screen with an image which would save lots of power. I've tried making nice interfaces with GUI toolkits and its a nightmare.
- KeplerBoy 5y agoHe has a valid point, generating the image on a separate device (heck, you could do that on AWS Lambda for free) and only grabbing the resulting image could vastly improve battery life. Then you could also switch from a power hungry Pi to a simpler choice like an ESP32.
- userbinator 5y agoPeople gluing together lots of stuff to making something barely-working and massively inefficient is not a new phenomenon. Unfortunately, all the "maker movement" seems to have done is encourage it more. Careful design, knowledge and learning is being discouraged in favour of superficial understanding, copy-pasting, tweaking-until-it-works. They don't want to spend the time to learn the basics. I was recently saddened to see someone who had published code for a tiny project in Asm being asked if there could be "an Arduino version". Some related philosophical discussions on that here: https://news.ycombinator.com/item?id=8679471 https://news.ycombinator.com/item?id=8679471
- jazzyjackson 5y ago> Careful design, knowledge and learning is being discouraged in favour of superficial understanding, copy-pasting, tweaking-until-it-works. This is like poo-pooing amatuer woodworking and saying “people should really become an apprentice first” - no one who has the education to do careful engineering is being discouraged, the field of hardware and software is now within reach of people who just wouldn’t take on any of these projects 10 years ago.
- userbinator 5y agono one who has the education to do careful engineering is being discouraged They are, because they think this stuff is just as good --- and it clogs the search results for those who do want to dig deeper. I often have to add "-Arduino -Maker" and a bunch of other filters to my search results to find the actually useful stuff.
- jazzyjackson 5y agoThis stuff IS good! It inspires people to task themselves with projects they don’t yet know how to do, and blog about what error codes they received and what they did to fix it. Besides, how can you look down on them when you’re googling for answers instead of, you know, RTFM / getting your engineering degree?
- jazzyjackson 5y agoclever and horrifying are not mutually exclusive he solved the problem with the tools he had, without spending time learning an alternative graphics layout system. I’m curious what you’d recommend as rudimentary tho, I would love to see such projects on lower power devices, but if you already need the Pi to talk to the ePaper, I don’t see the harm in burning a few cycles rendering a webpage to get the result you want.
- poisonborz 5y agoWhy tough? It works. What exactly is wasted here? 100MB for Chrome binary and that few percent of CPU hike while rendering the image? Is it worth wasting endless hours of time researching some niche, quirky, badly documented drawing library, where the hard earned end result has absolutely negligible difference from a human standpoint? Machines work for us, not reverse.