Skip to content

Read (or guess) size of raw RGBA/RGB files #2261

@smiRaphi

Description

@smiRaphi

Windows OS version

Windows 11 25H2

ImageGlass version

9.4.1.15

ImageGlass release

Classic

1️⃣ Describe the feature

example file name: 512x512.rgba
This should then be parsed to ImageMagick as an RGBA image with dimensions 512 x 512, little endian & bit depth 8.
example file name 2: chr_e_db41a_body_256x512.rgba4444be
This should be parsed as RGBA 256 x 512 big endian with bit depth 4.

But if a file doesn't have the size in the file name, try guessing it based off of file size & format:
example file: 1mb, RGBA
So to calculate the dimensions:

root(size*8/BitsPerPixel)
root(1048576*8/32 = 262144) = 512

Aliases for formats should also be supported, so:
RGBA == RGBA8 == RGBA8888
RGB == RGB8 == RGB888

As ImageMagick also needs the depth, that can also just be derived from the extension with 8 bits per color being the default (so the aliases above are correct).

2️⃣ How to use feature

Open an .rgba/.rgba8/.rgba8888/.rgb565/.rgb/.rgb8/.rgb888/.rgba4/... file
I would also personally say that extensions with endianess also have to specify the bit depth so .rgb8be and .rgba8888le would be allowed but not .rgble

3️⃣ Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions