While ingesting some books with JP2 encoded OBJ datastreams in its pages, I noticed a weird behavior on the OBJ->JP2 derivative processing logic.
If you look at the following lines:https://github.com/Islandora/islandora_solution_pack_large_image/blob/7.x/includes/derivatives.inc#L49-L51
"Create Lossless Derivatives" checkbox option (disabled) by default, at "admin/solution_pack_config/large_image" forces every jp2 encoded OBJ datastream to be copied directly to the JP2 datastream. The logic behind that makes little sense, some examples of that:
- I have an OBJ datastream that already contains a jp2 , lossless encoded image. And i have not selected "Create Lossless Derivatives", which means "Please create lossy derivatives". Current code will copy my lossless OBJ to JP2 not respecting - unselected - option. Now i have in OBJ and JP2 the same data
- I have an OBJ datastream that already contains a jp2, lossless encoded image. And i have selected "Create Lossless Derivatives", which means "Please don´t create lossy derivatives". Our Current code will convert my JP2 into a tiff and then apply lossless Jp2 compression and store that into JP2 datastream. Weird situation, long processing on no benefit. I end having again both datastreams being equal in size and quality
- Same goes if the OBJ has jp2 but already lossy compressed.
We should assume that if the user is providing whatever valid OBJ mime/type, that is its best master possible and making obscure-blind decisions on derivative creation for him is bad. If the origin is Jp2 whatever the compression is, and lossy derivatives are allowed by user´s decision, then Jp2 re-compression should happen. If not allowed and the user wants lossless, then taking that OBJ and expanding to tiff and recompressing IS the right way to go.
Does this make sense? Currently if you start with an jpeg2000 compressed OBJ datastream, the options are really none.