Hacker News new | ask | show | jobs
by jeresig 4041 days ago
NNEDI3 is fantastic - thank you for providing a link and some samples!

You're absolutely right that I shouldn't have said "normal". I update the post to clarify that this was using "OSX Preview". I did some hunting but didn't find any obvious pointers as to which algorithm they're using. If anyone knows offhand I'll be happy to include it!

2 comments

Talk with the imgix.com folks about the CoreImage stuff. They're using the built-in re-sampling in their product.

Also chat with @deepbluecea who's done a lot of image processing stuff, including for Apple.

I looked at what imgix was using a few weeks ago on HN. The resampling they do is really poor. You can do much better with imagemagick.

https://news.ycombinator.com/item?id=9501601

Yeah, why they're going through all that hardware effort, I dunno. Simpler developer workflow I guess. Would be interesting to do a cost/benefit vs. just using a Linux stack.
The 'hardware effort' is to get dramatically improved processing time by using the GPU since they're trying to do it on a much larger scale.

I have/continue to use imagemagick and similar software-based solutions and they're pretty slow for multi-MB images (but most servers don't have good GPUs so it's the only solution unless you're building custom racks as imgix does).

Yeah, I'm not super sure about the dramatically improved processing time. Especially compared to a SIMD-optimized scaler. You have to spend some time sending the image to the GPU and reading it back too.

Especially if you set imagemagick to use the much worse scaler that imgix uses, I imagine it'd be pretty fast.

On the other hand, if you replaced imgix's stack with the high quality scalers from mpv (written as OpenGL pixel shaders), and then compared to expensive CPU scalers, I would expect a GPU solution to be a win.

Note that imgix also has to recompress the image as PNG or JPEG at the end. This has to be done on the CPU and is probably more resource intensive than any of the scaling.

You can upload 100s of MBs of texture data to a GPU in milliseconds. Sending and receiving from GPU doesn't actually take that long in comparison to the time it takes to process a multi-MB file in software.
At least use GraphicsMagick, it's a lot faster in my (limited) experience. Unfortunately, I couldn't turn up any decent benchmarks.
Thanks for the tip, I had assumed it would be similar in feature-set/speed to imagemagick so hadn't tried it yet.
Well, OSX Preview seems to be doing something interesting as I can't seem to find an exact match with some quick attempts, but whatever method they use it looks rather similar to Lanczos scaling.