Console #176 -- Interview with Dirk of ImageMagick - a powerful image manipulation software
Featuring Ancient Beast, open source Rover, and ImageMagick
🤝 Sponsor - Hal9
Chat with your enterprise databases using secure generative AI and empower business users in your team to do their own data analyses in seconds.
🏗️ Projects
Browse through open source projects on OpenSourceHub.io, add your project to get more exposure and connect with other maintainers and contributors!
Ancient Beast
Ancient Beast is a turn based strategy indie game project played online against other people featuring a wide variety of creatures to acquire, putting them to use in order to defeat your opponents.
language: JS stars: 1418 last commit: 2 weeks
osh: opensourcehub.io/freezingmoon/ancientbeast
map: app.codesee.io/maps/public/8208…0c
NASA Open Source Rover
A $1600 build-it-yourself, 6-wheel rover based on the rovers on Mars!
stars: 7764 last commit: 3 days
repo: github.com/nasa-jpl/open-source-rover
site: opensourcerover.jpl.nasa.gov
ImageMagick
ImageMagick is a FOSS suite for displaying, converting, and editing raster image and vector image files. It can read and write over 200 image file formats, and can support a wide range of image manipulation operations, such as resizing, cropping, and color correction.
language: C stars: 9864 last commit: today
repo: github.com/ImageMagick/ImageMagick
site: imagemagick.org
Join thousands of other open-source enthusiasts and developers in the Open Source Hub Discord server to continue the discussion on the projects in this week's email!
🎙️ Interview with Dirk of ImageMagick - a powerful image manipulation software
Dirk started contributing to ImageMagick in 2013, and is currently one of the maintainers of the project. He can be followed on GitHub, Twitter, or LinkedIn.
Hey Dirk! Thanks for joining us! Let us start with your background.
I am living in the Netherlands and have been working in software development for a lot of years now. Most of those years have been in the backend of .NET projects on the web. But I have always been interested in other languages and frameworks. Once I started to work on open source this has become more broad because I had to learn new languages, frameworks and tools. And every year I try to code in a new language when solving the adventofcode.com puzzles in December.
Why was ImageMagick started?
This project was started in 1987 when the company the founder of this open source project was working for, needed to reduce 24-bit images to 256 colors because monitors that could display those images were really expensive back then. And in 1990 the founder asked if the company would allow them to open source this project and they did. Since then, a lot of changes and improvements have been made to this project, and it has been used by a lot of people and companies. Some even started their company with our library. I joined this project in 2013 and my focus has been to make sure that this library can be used on Windows. If you are interested in the complete history, then please take a look here: https://imagemagick.org/script/history.php.
How does ImageMagick work?
The ImageMagick library can be used to read an input image, perform image operation and then write an output image. The input and output format can be different, with over 240 input and 190 output formats. Once the input image has been read, the pixels and metadata of the image are stored in our own format that supports images with huge dimensions. This internal format allows us to write generic methods that can be used to change the image. We have over 300 operations that can be done, and examples of this would be resizing or rotating the image. Some of the operations can be done with the help of the graphics card (OpenCL) depending on the brand of the card. We don’t support all brands because we had some issues with some of them. But we cannot debug those issues because we don’t own graphics cards of those brands.
Who, or what, was the biggest inspiration to start working on ImageMagick?
The inspiration to work on this project started when I was working for a company called Snakeware that required a library to convert certain types of images to formats that can be viewed in a web browser. The input images were in the PSD format so we had to find a library that would support reading this format and found a project that was hosted on CodePlex and could be used to read those PSD files. This library used ImageMagick, was written in a C++ and could be used as a .NET library due to tooling provided by Microsoft. But this library had some issues. It had memory leaks and contained some bugs in the implementation. So I reached out to the creator of this library to get this fixed but got no response. But because this was causing issues in the application that was using this library I created a fork of that project and made the patches in the library. But after we deployed the application we realized that we were still getting memory leaks and it turned out that those were bugs in the ImageMagick library itself. At this point I went into the C code of ImageMagick to look for bugs and found a couple issues. Because the code of ImageMagick was at this point in time hosted in an SVN repository I had to report issues I found to the maintainer of this project (John Cristy) by email. The replies I got were very friendly and the bugs that I reported were fixed really quick. After a couple of emails going back and forth I was asked if I would want access to the project and make those patches myself instead. This was something that I did not need to think about for a long time so I responded that I would like to become part of the project and since then I have been working on the ImageMagick project.
What are some of the most common use cases for ImageMagick?
The most common use case would be resizing an image on a website. Our project is used in a lot of websites without visitors ever realizing this is done. Other use cases would be a product that uses images to do something. The ImageMagick library could then be used to add support for reading input images in a lot of formats.
What is the most challenging problem that’s been solved in ImageMagick, so far?
I don’t think I have solved a lot of challenging problems so I will just share some examples of things that I did to improve the library. When I started working on this project it was hosted on our own servers and we were using SVN for our source code. In 2015 I moved the code to GitHub and switched to GIT to make it easier for other people to help us with our project. I am also responsible for making sure that this project and its dependencies can be built and used on Windows. We were also one of the first projects that used GitHub Actions to automate our Windows release. But we also use it to check the build on other platforms. And as one of the early adopters of GitHub Discussions we now have a nice platform that can be used to communicate with users of our project. And recently I have added some tooling that helps us to keep the Windows dependencies up to date. Because I also work on the .NET library of ImageMagick I have added a lot of unit tests (over 3000 now) that check various functionalities of the ImageMagick library and make sure that we don’t break something on Windows, Linux or MacOS (x86/x64/arm64) (libc/musl) (clang/gcc). Making those changes and using GitHub as a platform allows us to focus on the code of the library and have protections that make sure that we have stable releases. It also allows us to have frequent releases that add new features and fix bugs. And having this in place made it easier to work on a feature that we added recently where we wanted to use a 64-bit enumeration in C. Our library allows you to perform operations on a single channel or multiple channels and with this enumeration we could set a flag for one of our 64 channels. Our builds showed that this did not work on all platforms or with some compilation tools so we had to do experiments to make this work. For the Windows build that uses Visual Studio we had to switch to the C++ compiler and for other platforms we had to add specific compilation flags that resolved this. Having those builds in place allowed us to have a lot of checks that make sure it works on the platforms that we run those builds on.
What was the most surprising thing you learned while working on ImageMagick?
I was surprised how many open source projects have small teams. Most people (including me) think that projects that are used by a lot of companies and people have a big team to work on that project. But we also have a small team with only two developers and 2-3 people that help us with answering questions from the community. And most open source projects are being worked on in people their spare time. I am also only working on this project in my spare time. So please make sure you have some patience when you report an issue in an open source project.
What are you most proud of?
One of the things that I am most proud of is that I became a Microsoft MVP last year and still am one today. Working in open source and having software that I created in the public being used by Microsoft has led to this. And because I work in the open I have also been in close contact with GitHub and was lucky to be one of the first ones to try their new products (Actions/Discussions/Codespaces). This also led to me being invited to visit GitHub Universe in 2019 and travel to the United States for the first time in my life. And while being there I also met with someone of the ImageMagick team. I was also lucky to meet some of the people that use the libraries that I work on in person or online through a video call.
How do you balance your work on open-source with your day job and other responsibilities?
A couple of years ago I switched from a 40-hour work week to a 36-hour work week and those 4 extra hours are now being used to work on the various open source projects that I work on. And one really important thing that I always keep in my mind is that my open source work is voluntary, so I don’t have an obligation to work on it. I work on it when I want to and have time to do it. That also avoids the risk of getting a burnout if I would spend more time on it than is healthy for me.
What is the best way for a new developer to contribute to ImageMagick?
Our project is quite specific so we don’t often get new contributors who join our project. But we do have a lot of things that we could use some help with here: https://github.com/ImageMagick/ImageMagick/discussions?discussions_q=is%3Aopen+label%3A%22up+for+grabs%22 and here: https://github.com/ImageMagick/ImageMagick/labels/up%20for%20grabs. And we also always welcome pull requests if you happen to be involved in a new image format or want to add support for a format that we don’t support yet. And if some kind of image operation is not yet supported then feel welcome to add this to our project.
Where do you see the project heading next?
That is not an easy question. I think we will continue to work on this project to improve the quality and performance of the library. We will also keep an eye on new languages and new technologies to see if we could use them in our project. An example of this are devcontainers (known as Codespaces on GitHub). We have added them to the ImageMagick project, but I have also added them to my own projects to make cross-platform development easier.
What motivates you to continue contributing to ImageMagick?
Working in open source has taught me a lot of things. I learned a lot of new languages, new tools and new technologies. This also helped me in my professional career because this would train me in certain tools or technologies. I was working with Docker/WebAssembly in opensource projects before I used this professionally. As long as I can learn new things, I will continue to contribute to open source projects.
Are there any other projects besides ImageMagick that you’re working on?
Besides ImageMagick I also work on projects that use ImageMagick. First of all, my Magick.NET library that makes the ImageMagick library usable on the .NET platform. I have also contributed to the RMagick (Ruby) project by porting their code to be compatible with version 7 of ImageMagick that included a lot of breaking API changes. And at the end of 2019 I started a new JavaScript library (magick-wasm) that makes it possible to use the ImageMagick library in a browser with the help of WebAssembly.
Do you have any suggestions for someone trying to make their first contribution to an open-source project?
I would advise them to contribute to a project when they find a bug, missing documentation or want to help improve a build pipeline in a project they are using. Even when they think it’s just a small contribution, it can still help the maintainers of a project. But make sure to first read the CONTRIBUTING document of a project to make sure you follow the process of that project.
Want to join the conversation about one of the projects featured this week? Drop a comment, or see what others are saying!
Interested in sponsoring the newsletter or know of any cool projects or interesting developers you want us to interview? Reach out at osh@codesee.io or mention us @ConsoleWeekly!