Recent advances in microscopy have pushed imaging data generation to an unprecedented scale. While scientists benefit from higher spatiotemporal resolutions and larger imaging volumes, the increasing data size presents significant storage, visualization, sharing, and analysis challenges. Lossless compression typically reduces the data size by <4 fold, whereas lossy compression trades smaller data size for the loss of a precise reconstruction of the original data. Here, we develop a novel quantization method and an artifact metric for automated compression parameter optimization that preserves information fidelity. We show that, when combined with the AV1 video codec, we achieve tens to ten thousand folds of data compression while introducing negligible visual defects or quantification errors in single-molecule localization and segmentation analyses. We developed an HDF5 filter with FFMPEG library support for convenient community adaptation. For instance, HDF5-enabled ImageJ plugins can now be seamlessly extended to support AV1 compression and visualization to handle terabyte-scale images.