To make ImageMagick heavy processing demands friendly to the rest of Traffic Server duties, the heavy lifting is done on a thread coming from an internal thread pool and does not block other requests from being served on the event threads. The modified content is also stored into Traffic Server's cache, making subsequent requests to the same URL skip processing altogether and be served in a blink of an eye. All happens in memory and no external process is spawned. From then on, the real ✨magic✨ starts to happen and once the ✨trick✨ is done, the plug-in ✨reveals✨ the output to the requester. The origin's response body is copied into a ImageMagick's internal buffer representation. Then the magick query parameter gets decoded back into command-line parameters that are plugged into the MagickWand's API. The 622 lines of code work by inspecting the Content-Type response header from the origin and checking if that is a recognized MIME image format. ![]() It turns out ImageMagick exports all necessary interfaces through the MagickWand API. This way, I would be able to write different modification scripts and plug them into their image URLs with no modifications into the plug-in itself. The ProjectĪfter realizing how flexible ImageMagick command line tool is, my weekend plan became clear: What if I connect the powerful ImageMagick command line parser into an URL through a query parameter. To flip an image for example, you would execute a command like $ convert in.jpg -flip out.jpg. ImageMagick also has a powerful command line tool, which allows you to convert an image based on command line arguments. Software engineers are cheap on keystrokes and love to solve problems generically. The code written to resize is very different from the code to insert a text into the bottom right corner of a picture. Using an API has the limitation of requiring code to be written every time you want to apply a different change into an image. A software engineer writing C++ would use the ImageMagick++ library. ImageMagick can be programmatically used through its extensive APIs. To check all you can do with ImageMagick, I recommend visiting Fred's ImageMagick Scripts web site to see the software being taken to its limits. You can crop it, resize it, rotate it, convert it into different formats, write text on top of it and apply different filters. ImageMagick allows you to modify any images with all sorts of editing tools. After seeing some activity around the use of ImageMagick, I decided to focus my attention on ImageMagick, a well established library used for image manipulation. To discover what aspects of ATS Netlify might be interested in, I explored the contributions the team had previously made. Traffic Server is mainly written in C++ and allows customizations to be added in the form of plug-ins. I was interviewing for a position which would involve maintaining, extending and contributing to Apache Traffic Server, a high throughput open source HTTP proxy that I used to work with on a previous gig. ![]() My interview process at Netlify included some practical work which not only gave me a chance to show how I explore and learn, but also gave me the chance to share what I learned as contributions to the Apache Traffic Server open source project. Technical interviews can be difficult to do well. News & Announcements An interview process to learn from - ImageMagick Lessons and ATS contributions
0 Comments
Leave a Reply. |