4 ms·
Several years ago I had to do something similar (10 of thousands instead of millions though). Our problem was that we were making a composite image but sometim
by bockris 16y ago
Several years ago I had to do something similar (10 of thousands instead of millions though).
Our problem was that we were making a composite image but sometimes the 'background' image content was shifted to the left or right. (e.g. All images were the same size with a white background but some were made from different source template and so the actual content sometimes started at pixel 25 and other times at pixel 35.) To make it worse they were all JPEGS.
I ended up writing a program to find the bounding box of the content (with a fudge factor to account for the JPEG dithering) and identified the bad images to be fixed by hand. It was a nice diversion from SQL and ASP.
- timmorgan 16y agoWhat tools did you use and how long did it take?
- bockris 16y agoThis was in 2002 and I used Python with the PIL module. It didn't really take all that long, less than a day for the whole project. Probably 2-3 hours of run time on my desktop. I wasn't actually doing anything but identifying the bad images so I wasn't pounding the disk with alternating reads/writes.
- blasdel 16y agoPIL is fucking amazing, I've never seen anything like it for any other language. Last year I used it to write a computer vision utility for doing black-box UI testing on embedded medical devices, and I can't imagine having used anything else. Right now I'm fighting RMagick on another project, I would have set the building on fire if I'd had to deal with it's bullshit on the CV project. It links directly with libjpeg, libpng, etc. instead of via some imagemagick bullshit. Instead of being fucked if what you want to do doesn't line up with an existing magick command, it gives you the tools to do it yourself, and even pretty performantly since it can give you numpy arrays.