Compress textures with Photopea
Today, we are adding a new feature into Photopea: the support for DDS textures.
Modern video games are accelerated with technologies such as OpenGL, DirectX or Vulkan. The view of the game is rendered "in parallel" by hundreds of small processing units. Each unit may need to access a specific part (pixel) of some texture (e.g. the bottom left pixel).
In modern image formats (such as PNG or JPG), it is not possible to view a specific part of the image. We must decompress the whole image first. Thus, JPG and PNG files can not be directly used with OpenGL. But with many large textures, some kind of texture compression would be really handy.
In past years, new techniques have been developed (such as S3TC), which can make textures even eight times smaller (than uncompressed), while still appropriate for OpenGL (easy to access by processing units). The image is divided into small parts: 4x4 pixels. Each such part is compressed independently. When a processing unit needs to read some pixel, we first check, in which 4x4 part the pixel is located. Then, we decompress that part (all 16 pixels), read the pixel in concern, and throw away the information about other 15 pixels.
Textures, compressed this way, are usually stored in DDS or similar files. Starting today, Photopea can open these DDS files. It can also export textures in DDS format using File - Export - DDS. Try to download this DDS file and open it in Photopea!
This is a next step in our journey to make Photopea open any image format. We released our compression methods in an open-source library UTEX.js. We believe it can have many applications besides Phtopea editor.