OK way too many nerd thoughts today:
- 16-bit vs 8-bit color and 5400 vs 2700 dpi resolution scanning. I’m scanning lots of old photos. Until now I’ve been using JPEG because they are small, but the lack of 16-bit color has really bothered me. Even snapshots with crappy cameras show light and dark issues with only 8-bits and these are archival. But Vuescan creates 214MB TIFs with 5400 dpi. So I need to turn the dpi down (5400 is a lot given that a crappy lense is certainly not going to generate a 44 megapixel resolution!). So moving to 2700 (or 27^2*1.5=10MP) seems more reasonable. That stinks the 214MB TIF to just 50MB. Which in todays world is actually OK.
- JPEG vs JPEG2000 vs OpenEXR vs TIF. The other solution is to go to a lossy 16-bit format. The main problem is that JPEG is *still* just 8 bits. There are some not great choices here, but JPEG2000 is 16 bit and they say OpenEXR might work. Way off in the weeds in terms of format and with today’s hard disk, maybe 50MB is OK. JPEG 2000 has a C level open source implementation called Open JPEG and a command line interface so the workflow is Vuescan to TIF then batch convert to JPEG 2000.
- OpenEXR. I have used this for HDR images, but it also works for regular ones. It was developed by Industrial Light and Magic and apparent Mac Preview will write it which made me super happy until I tried it and discovered Preview only write 8 bit color for JPEG-2000 and OpenEXR. It just grays out 16-bit!
So on to other options to get OpenEXR or JPEG 2000 in order of trying things:
- Openjpeg. It is the reference implementation of JPEG 2000. It is a command line thing and you can just `sudo port install openjpeg` and it appears on your Mac. The main problem is that it does not support color profiles and strips them from the TIF files. I use ProPhoto profile as this uses lots more colors and is suitable for 16-bit display. Only Adobe Photoshop seems to support it correctly. Also by default it does lossless compression. That compression is better than TIFs. A 220MB TIF becomes a 175MB JP2. If you want some compressions, then the parameters looks like `opj_compress -i <input> -o <output>.jp2 -r 3` for 3x reduction. However you lose the color profile. I did try to add a profile with exiftool which failed on the j2k image but appeared to work on the jp2 image, but when using preview, it didn’t show any ICC profile. And when opened with Photoshop, it shows an sRGB profile which is not right. Even converting to ProPhotoRGB does not fix it.
- OpenEXR. This is just a library, but you can get it with `sudo port install openexr`. However it doesn’t have a user interface. Again it looks like using a Photoshop plugin is a better approach.
- GIMP. I had forgotten about gimp which an open source image editing application like Photoshop. And with mac ports, it is a simple `sudo port install gimp` to get it and it appears to have a JPEG 2000 plugin.
- GIMP 2.9. It looks like their latest version moves to 32-bit color processing and supports OpenEXR. Perhaps a better format long term as ILM is using it for everything. This is a little trickier to get as it is an intermediate point before 2.10, but you basically can git clone and then compile it however the dependencies definitely make it hard to build. But perhaps, the jenkins docker image is the answer. Docker really does solve so many problems. I’ll drop for now until 2.10 comes out as building is a pain.
- Lightroom. I tried it but wasn’t surprised to find that JPEG-2000 isn’t supported as an export type by lightroom. Just JPEG and TIF.
- Photoshop. Well I try to get away from Photoshop, but I guess it is impossible. Photoshop reads and writes 16-bit JPEG 2000 and include the ICC profile in it. So sometimes, the most obvious answer is right there in front of you. At first it looks like it only produces 8-bit JPEG 2000 files so that is disappointing as reported by Mac Preview, but when I look in Image/Mode and File/Info on Photoshop it says it is in fact 16-bit, so looks like a problem with Mac Preview.
So the workflow is a little clunky now. Scan old images with Vuescan at 5400 dpi to 48-bit RGB TIF. Then use Photoshop to open this monster 220MB file and save as a JPEG 2000 with 90% reduction. While it is not lossless, I would certainly trade the higher resolution and color depth for the size.
It looks like setting it for lossless compression gets a 5400 dpi 35mm slide at 16 bits per color down from 220MB with TIF to 170MB with lossless JPEG-2000 and 40MB with JPEG-2000 set at 90% image quality. That’s actually not too bad given today’s hard disks. I was getting about 12MB for a 5400 dpi 8-bit color, but of course this is JPEG-2000 is supposed to handle artifacts better so it is going to be a bit more than doubling the file size.