Skip to content

Conversation

@mel-mason
Copy link
Member

@mel-mason mel-mason commented Feb 15, 2024

Add support for normal map and depth map images from our Archiox project, which include 16 bit and RGBX images

irv and others added 4 commits December 7, 2023 10:50
For scientific images coming from the ARCHiOX project, they are 16bit tiffs wcontaining depth or normal maps. For conversion to jpg for thumbnail purposes, we attampt to downsample to 8bit. FOr conversion to JPEG2000, I think Kakadu can handle these as JPEG2000 does support these bpp values. We need to allow the different Pillow image modes, though.
@mel-mason mel-mason self-assigned this Feb 15, 2024
@mel-mason mel-mason changed the title [WIP] Depthmap fixes [Draft] Depthmap fixes Feb 15, 2024
@mel-mason mel-mason marked this pull request as draft February 15, 2024 15:30
if source_image.mode != converted_image.mode:
if source_image.mode == BITONAL and converted_image.mode == GREYSCALE:
logger.info('Converted image is greyscale, not bitonal. This is expected')
elif source_image.mode in ['RGBX', 'I;16'] and converted_image.mode in ['RGB', 'RGBA']:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exception is only necessary for conversions from TIFF to JPG when creating thumbnails, and we don't usually run this check on the thumbnail, so I'm removing this to keep the validation as stringent as possible

conversion.Converter().convert_to_jpg(filepaths.NORMALMAP_TIF, output_file, resize=None,
quality=derivative_files_generator.DEFAULT_JPG_HIGH_QUALITY_VALUE)
assert os.path.isfile(output_file)
validation.check_colour_profiles_match(filepaths.NORMALMAP_TIF, output_file)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method isn't really designed to check the result of a lossy conversion from tif to jpeg, so will fail here - I'll remove this line

…eeded for tiff->jpeg conversion. Move normal/depth map jp2 conversion tests to derivatives_generator and add losslessness checks. Remove colour profile check for jpg conversion tests. Decompress normal_map.tif so demo kakadu versions can run the tests.
…ed it lost the RGBX colour mode. Add RGBX support - convert to RGBA. Document RGBX support
@mel-mason mel-mason changed the title [Draft] Depthmap fixes Depthmap fixes Mar 5, 2024
@mel-mason
Copy link
Member Author

I've checked that the docs changes build correctly

@mel-mason mel-mason marked this pull request as ready for review March 5, 2024 16:15
@mel-mason mel-mason requested a review from irv March 5, 2024 16:16
Copy link
Member

@irv irv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look's good, thanks @mel!

@mel-mason mel-mason merged commit b4eccee into master Mar 7, 2024
@mel-mason mel-mason deleted the depthmap_fixes branch March 7, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants