News for hackers. Stuff that matters.
Re:Dependency by WesolyKubeczek on Monday August 17, 2020 @08:35PM (#24194027)
I keep a nice bottle of red just to celebrate the day I rip ImageMagick from the guts of the project I’m working on.
Re:Dependency by jjcm on Monday August 17, 2020 @08:40PM (#24194057)
As someone who's just now building imagemagick into a system I'm working on as a major dependency, what issues have you had with it?
Re:Dependency by WesolyKubeczek on Monday August 17, 2020 @09:05PM (#24194232)
I have that issue that it's an overkill for just resizing images (which is what we're using it for; previously it might have had more uses, but now is reduced to this). Also, it gets patched for security often. Like, really often. Maybe more often than it feels comfortable to update.

Then, there are major incompatibilities between versions 6.9.x (which is what is even in the latest Fedora, likely other distros as well) and 7.x (which is probably what's sane to use in this day and age). Which means that to use 7.x, you're likely to have to roll your own and tuck it in its own LD_LIBRARY_PATH. That hurts.

The cherry on top in my particular case is PerlMagick. It's not installable in any way other than with the ImageMagick itself. You cannot have just Perl modules, which you "perl Makefile.PL && make && make install".

When you see separate packages for ImageMagick and PerlMagick in your distro, it means that the maintainer has compiled the whole ImageMagick, then torn it apart. A corollary to that is that PerlMagick is tied to binaries it came with real tight, and updating one means updating the other most of the time.

Then again, it's very likely that you use some other bindings to ImageMagick and my pain is not like your pain.

Re:Dependency by walrus01 on Tuesday August 18, 2020 @02:12AM (#24195775)
I agree using imagemagick to resize images is ridiculous overkill, that's using something like 0.01% of what it's capable of...

But then again we also use groupware/chat programs these days that occupy more RAM on the workstation OS than the entire amount of physical RAM in all of the BSD/Linux servers of a mid-sized ISP 18 years ago.

Re:Dependency by renewiltord on Tuesday August 18, 2020 @03:02AM (#24195975)
RAM usage is your concern? Then using ImageMagick to resize an animated gif is going to get you very quickly acquainted with policy.xml

It doesn’t use intermediate disk store for frames AFAIK so you’d better have enough RAM.

In fact, you’d better just resize with ffmpeg and then convert to gif there.

Re:Dependency by sanderjd on Monday August 17, 2020 @11:49PM (#24195059)
Yep, a big bundle of hard to compile code written in an unsafe language.
Re:Dependency by ALittleLight on Tuesday August 18, 2020 @02:35AM (#24195864)
Isn't it super easy to resize images? I wrote a program to resize images after watching a computerphile video on the subject and it took like ten to twenty minutes to get something that seems functionally identical to "real" resizing. If you can read your image as a two dimensional array of bytes you can resize easily enough.
Re:Dependency by innocenat on Tuesday August 18, 2020 @07:00AM (#24197254)
If you only want bilinear and nearest-neighbor, yes.

Lanczos is much less easy to write, and is even harder to make it run fast.

And there are things like subpixel positioning (it is way too easy to make resizer that shift image by 0.5 pixel)

Re:Dependency by account42 on Tuesday August 18, 2020 @08:56AM (#24198014)
Add on top of that correct gamma and color space handling...
Re:Dependency by prerok on Tuesday August 18, 2020 @03:23AM (#24196094)
The power of ImageMagick is when you need to support multiple formats. Resizing BMP is easy, the hard part is supporting the various ways that data is encoded.
Re:Dependency by detaro on Monday August 17, 2020 @09:10PM (#24194268)
Not the parent poster, but it does a lot and is a regular source of potential security issues, and there's always a worry you haven't turned off everything you don't need etc. So if I process external inputs and don't really need ImageMagick, I prefer using more limited pieces.
Re:Dependency by WesolyKubeczek on Monday August 17, 2020 @09:23PM (#24194353)
Yeah, the frequency with which they have to make security patches is telling a lot about the overall code quality.

One might argue that it's because it's more popular than other similar projects, but it doesn't happen as often with, say, Pillow. And I don't quite remember PIL/Pillow having holes as big as ImageMagick.

Also, try actually programming against it. Whatever language you choose, it's going to feel clunky and alien. It feels alien in C. It feels alien in Perl. Even in PHP, the match made in hell, it feels thoroughly un-idiomatic. I'm not even surprised they have to patch it up now and then.

Re:Dependency by jefftk on Monday August 17, 2020 @09:47PM (#24194480)
Parsing complex untrusted inputs in a language that isn't memory safe is the center of the unholy venn diagram. It's very hard to do a good job under those conditions.

While "rewrite it in Rust" is a cliche, I think ImageMagick is a good candidate!

Re:Dependency by iou on Monday August 17, 2020 @10:05PM (#24194565)
Re:Dependency by WesolyKubeczek on Tuesday August 18, 2020 @04:06AM (#24196295)
Can it easily sprout bindings to other languages, especially given Rust’s ABI stability guarantees which are as firm as melted icecream?
Re:Dependency by detaro on Tuesday August 18, 2020 @05:25AM (#24196729)
Its README addresses that. TL;DR: it exposes a C-API and offers bindings based on that, like pretty much any language allowing bindings would.
Re:Dependency by nardi on Monday August 17, 2020 @09:10PM (#24194270)
Replying to sibling comment: It's only overkill if you know in advance you only need one specific kind of input file format. If you need to process many (or arbitrary) image formats with excellent compatibility, then ImageMagick is a godsend.
Re:Dependency by jandrese on Monday August 17, 2020 @09:49PM (#24194489)
ImageMagick always seemed to be a bit shaky to me. I usually prefer to use netpbm when I can because each utility is so tiny that it just feels better.
Re:Dependency by wtracy on Tuesday August 18, 2020 @02:02AM (#24195735)
Netpbm seems to have terrible support for modern image formats. Unless I'm missing something, I can't imagine using it to handle user-supplied images.
Re:Dependency by inopinatus on Monday August 17, 2020 @10:12PM (#24194585)
Came here to suggest libvips, but whilst checking my facts discovered that even it too has an (optional) dependency on ImageMagick.
Re:Dependency by Lammy on Tuesday August 18, 2020 @01:05AM (#24195458)
That's optional and only for loading (not saving!) of additional filetypes outside the ones implemented by libvips itself.
Re:Dependency by mceachen on Monday August 17, 2020 @10:35PM (#24194713)
PhotoStructure (very happily) uses libvips (via sharp) and doesn't include any ImageMagick pieces-parts.