News for hackers. Stuff that matters.
Re:Dependency by outworlder on Monday August 17, 2020 @08:06PM (#24193777)
Image title:

> Someday ImageMagick will finally break for good and we'll have a long period of scrambling as we try to reassemble civilization from the rubble.

EDIT: don't forget to always hover over the image. Half of XKCD's fun comes from those tidbits.

Re:Dependency by II2II on Monday August 17, 2020 @11:45PM (#24195042)
I was fumbling with a random piece of software one day, then realized that ImageMagick was installed as a dependency. "Oh," I thought, while recollections of years past flooded my mind. After a few minutes of reading ImageMagick documentation, I stopped fumbling around and completed the work with ImageMagick instead.
Re:Dependency by WrtCdEvrydy on Monday August 17, 2020 @08:16PM (#24193871)
Honestly, yes, imagemagick is such a ridiculous dependency for everything.
Re:Dependency by js2 on Monday August 17, 2020 @08:30PM (#24193992)
Re:Dependency by lmm on Monday August 17, 2020 @08:44PM (#24194090)
Those all do well-defined, well-understood things; they could be replaced relatively easily, and subjectively they "feel" pretty solid. ImageMagick is a complex thing full of subjectively flaky perl and it's not at all clear which things are and aren't supported by it. I'm a lot more worried about ImageMagick breaking than any of the things you list.
Re:Dependency by jacquesm on Monday August 17, 2020 @09:02PM (#24194217)
> they could be replaced relatively easily

That's leaving a pretty big loophole there and in the case of SQLite you'll need that. To re-create something that solid will take a lot of effort.

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.
Re:Dependency by AceJohnny2 on Monday August 17, 2020 @08:22PM (#24193921)
Why is GraphicsMagick [1] not a more popular alternative?

[1] http://www.graphicsmagick.org/

Re:Dependency by ashtonkem on Monday August 17, 2020 @08:25PM (#24193955)
Same reason any legacy dependency remains; the cost of replacement is higher than the cost of maintenance.
Re:Dependency by AceJohnny2 on Monday August 17, 2020 @09:19PM (#24194334)
It's meant to be a drop-in replacement, the cost of replacement should be negligible.
Re:Dependency by wtracy on Tuesday August 18, 2020 @02:08AM (#24195759)
Both projects are moving fairly fast, and regularly adding new features that are not shared.

The last time I made heavy use of ImageMagick/GraphicsMagick, I was suprised how often I would find a feature present in one and not the other (often things like drawing gradients).

And it's not like one has a superset of the other's features: I once painted myself into a corner and created a project that depended on both ImageMagick and GraphicsMagick.

Re:Dependency by yareally on Tuesday August 18, 2020 @01:26AM (#24195582)
There probably still exist some weird edge cases introduced by imagemagick that the developer(s) behind graphicsmagick haven't accounted for.

That is, should graphicsmagick account for quirks introduced by imagemagick? If it's meant to truly be a drop-in replacement versus one with some strings attached, I would say the answer is yes. Otherwise, you can't easily just drop it into a system and let it run.

Systems built with libraries around long enough as imagemagick likely have all sorts of workarounds built in over the years for that kind of behavior and any deviation from imagemagick might break things more than one expects. We've all been bitten by libraries that claim backwards compatibility with previous versions, only to find out there's breaking changes in some non-trivial use cases the library devs didn't consider. Add those complications on top of switching to a library that is supposed to be a drop in replacement and it can get pretty messy for what seemed like a trivial task.

Re:Dependency by LeoPanthera on Monday August 17, 2020 @08:30PM (#24193999)
Format support lags. For example, it does not currently support HEIF.
Re:Dependency by arthurcolle on Monday August 17, 2020 @08:37PM (#24194043)
almost nothing supports HEIF.

consider: most state-run web apps that need an image upload for personal ID images, or anything else. Ugh, this happens frequently for me and just frustrates me to no end.

EDIT: I suppose this is why you're saying ImageMagick is king right now.

Re:Dependency by LeoPanthera on Monday August 17, 2020 @09:27PM (#24194374)
Well, yes. It happened only recently, but ImageMagick does indeed support HEIF. :)
Re:Dependency by shmerl on Monday August 17, 2020 @08:33PM (#24194018)
Is it a fork?
Re:Dependency by runxel on Monday August 17, 2020 @08:41PM (#24194072)
Never heard of it either, but the homepage provides some info:

> GraphicsMagick is originally derived from ImageMagick 5.5.2 as of November 2002 but has been completely independent of the ImageMagick project since then.

Re:Dependency by jasonjayr on Monday August 17, 2020 @08:59PM (#24194188)
https://marc.info/?l=imagemagick-developer&m=104777007831767...

More info on the reason for the fork (at the time)

Re:Dependency by shmerl on Monday August 17, 2020 @09:14PM (#24194303)
Interesting. But today they are both collaborative projects?
Re:Dependency by Tade0 on Monday August 17, 2020 @08:19PM (#24193897)
And at the same time its bus factor is 1.
Re:Dependency by PaulDavisThe1st on Monday August 17, 2020 @09:26PM (#24194369)
"Honey, can we upload some new photos to my website?"

[ tech spouse takes a look at the image set ... rotated, various sizes, even different formats ... reaches for convert(1) and wonders why non-tech spouse can't do this easily ]

Re:Dependency by gpvos on Tuesday August 18, 2020 @12:04AM (#24195142)
I still prefer netpbm, much leaner.
Re:Dependency by ldd on Monday August 17, 2020 @08:49PM (#24194114)
I use imagemagick to split spritesheets into single images for games that I make[0]. More than 1 gamedev has saved countless of hours thanks to it, so I 100% hope it never breaks.

[0]: https://gist.github.com/ldd/9b576bb6f0ac99a0a7895eaf1aae7802

Re:Dependency by zzo38computer on Tuesday August 18, 2020 @02:12AM (#24195779)
My "ff-dice" program (together with "pngff" to decode PNG, and "ffpng" to encode PNG; these two also require LodePNG, which is included, and which itself has no other dependencies) also does that.

Netpbm also does this; you can use the "pamdice" program (together with "pngtopnm" and "pnmtopng" to decode and encode PNG). However, pamdice requires creating intermediate files, while ff-dice doesn't require that.

So, you have two more things to try if ImageMagick won't work.

Re:Dependency by ldd on Tuesday August 18, 2020 @08:16AM (#24197716)
Do you have a link?

Ironically, trying to good for `ff-dice` or `pngff` sends me back to this thread!

Re:Dependency by zzo38computer on Tuesday August 18, 2020 @05:43PM (#24204705)
There is a Fossil repository at: http://zzo38computer.org/fossil/farbfeld.ui

(Although there are a lot of files, you will only need to compile the files that you need, and you can delete the files that you don't need.)

Re:Dependency by ldd on Wednesday August 19, 2020 @05:33AM (#24208661)
awesome!
Re:Dependency by tclancy on Monday August 17, 2020 @09:40PM (#24194444)
Where’s the love for ffmpeg?
Re:Dependency by DaiPlusPlus on Monday August 17, 2020 @10:10PM (#24194580)
ffmpeg is great. I use it to transcode videos that our users upload directly from their phones from HEVC (H.265) to AVC1 (H.264) - it’s painless: just asynchronously shell-invoke it from Java, .NET, etc. I’m surprised it works well even in tightly locked-down sandboxed environments like Azure App Services (nee Azure Websites). It’s saved my org thousands of dollars we’d have otherwise spent on something like Azure Media Services. It “just works” and I’ve never had it fail to process any legitimate video file.

Props to ffprobe too - that’s part of our file upload + identification + sanitation process.

Re:Dependency by hjkhj7878 on Tuesday August 18, 2020 @07:50AM (#24197569)
Isn't H.256 the successor to H.264? Wouldn't H.264 use more space?
Re:Dependency by DaiPlusPlus on Tuesday August 18, 2020 @08:44AM (#24197931)
Chrome doesn’t support H.265 by-design, even if it’s host OS supports it, because Google is trying hard to encourage people to use the (purportedly) patent unencumbered WebM format and codec instead.

In summary:

H.264 has the widest adoption of all modern video formats.

H.265 is Microsoft + Apple.

WebM is Google and Firefox.

H.266 came out a few weeks ago.

Re:Dependency by rigrassm on Monday August 17, 2020 @11:19PM (#24194915)
For those on mobile, the https://m.xkcd.com url's provide a tappable alt-text link that shows these tidbits https://m.xkcd.com/2347/
Re:Dependency by saagarjha on Tuesday August 18, 2020 @06:00AM (#24196931)
In iOS you can long press in the image.
Re:Dependency by dag11 on Monday August 17, 2020 @09:15PM (#24194315)
This is the funniest (to me) alt text I've ever read. Had me chuckling for a solid minute!
Re:Dependency by shmerl on Monday August 17, 2020 @08:32PM (#24194010)
Thanks for the hint, I never knew it had tooltips with hidden messages :)
Re:Dependency by spanhandler on Monday August 17, 2020 @08:48PM (#24194111)
Not the only comic that puts a bonus in the img tag alt text—I think Wondermark does, and I wanna say that at one time SMBC did that and had the red-button extra panel, both, and it may still. I always check for it when I find a new webcomic, now.
Re:Dependency by yjftsjthsd-h on Monday August 17, 2020 @09:32PM (#24194402)
SMBC still does both.
Re:Dependency by saagarjha on Tuesday August 18, 2020 @06:02AM (#24196940)
Unfortunately the older comics didn’t get alt text, although many got the extra panel afterwards.
Re:Dependency by millisecond on Monday August 17, 2020 @08:34PM (#24194021)
There’s also m.xkcd.com if you tire of hovers.
Re:Dependency by gpvos on Tuesday August 18, 2020 @12:07AM (#24195155)
Ooh, thanks; useful when I'm using my phone (as the m indicates, obvs), which truncates hover texts.
Re:Dependency by saagarjha on Tuesday August 18, 2020 @06:01AM (#24196935)
Early betas of iOS 13 actually used to do this and xkcd was explicitly brought up as a reason to not truncate ;)
Re:Dependency by zzo38computer on Tuesday August 18, 2020 @02:04AM (#24195740)
There is also explainxkcd, which displays the title text underneath the picture, and has categorization, searching, explanations (in case there is anything you forgot, or do not know, or just want to read other people's commentary), transcripts (helpful for search, and also to copy the text), and more.

Additionally, if you have user CSS in your browser, you can force it to display the title text even in the official xkcd web pages (CSS has a command to display the text of HTML attributes).

Re:Dependency by Kiro on Tuesday August 18, 2020 @02:51AM (#24195914)
How do you do it on mobile?
Re:Dependency by johanbcn on Tuesday August 18, 2020 @03:01AM (#24195966)
Depends on your browser. On chrome, just long-press on the image until the context menu pops-up with the alt text on it.
Re:Dependency by Kiro on Tuesday August 18, 2020 @10:12AM (#24198753)
Thanks but it only shows the first part of it.
Re:Dependency by saagarjha on Tuesday August 18, 2020 @06:01AM (#24196934)
On iOS, long press on the image.
Re:Dependency by cribwi on Tuesday August 18, 2020 @02:57AM (#24195948)
Try using https://m.xkcd.com/ and click the comic to toggle the alt text
Re:Dependency by badrabbit on Monday August 17, 2020 @08:55PM (#24194157)
Or gpg