Exemplary embodiments address these and other issues relating to image transmission and receipt. The techniques described improve the speed and rendering quality of an image (such as a JPEG) and are particularly well-suited to an end-to-end encrypted environment (E2EE).
According to exemplary embodiments, the image may be analyzed on the sending-client side and the image data may be broken into multiple categories or segments. In one embodiment, the image data is broken into two chunks: a thumbnail chunk, and a high-quality image chunk. The full-quality image chunk depends on the thumbnail chunk, such that the image data from the thumbnail chunk is re-used when rendering the full image using the high-quality image chunk.
The sending client determines the chunks, identifies the chunk sizes, and calculates hashed-based message authentication codes (HMACs) over each of the chunks. The image data may be encrypted and uploaded to a blob store, and a notification message may be sent to the receiving client with the determined image information and a suitable decryption key. The receiving client may first download the thumbnail chunk and use it to render a thumbnail; in some embodiments, the thumbnail chunk may be automatically downloaded when a message is received. The user on the receiving side can view the automatically downloaded thumbnail and determine if they wish to download the full image at high quality.