Eddy Lin
Eddy Lin

Reputation: 525

How to decode this image?

I have an image file, which is 1048592 bytes length. 16 bytes header and 1048576 bytes data. The begining bytes of its hex looks like below, does anyone know how to decode it?

504b 4d20 3130 0000 0400 0800 0400 0800
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0203 0310 37ff ff00 485f 76d2 0d99 0331
7878 8f3e 110e 1186 2a2a 3bc9 7391 f733
1d1d 1de2 fff7 0008 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000
0000 0002 ffff 0000 1213 14d0 337f 7f80
4444 4685 1d91 333f 2636 37cd 3b9d 7fbb
0303 0315 f777 cccc 0000 0002 ffff 0000
0000 0002 ffff 0000 0000 0002 ffff 0000 
....

Upvotes: 2

Views: 1443

Answers (4)

CRSouser
CRSouser

Reputation: 678

The header states it is a PKM image format.

The format is:

  • 4 byte magic number(504b 4d20): "PKM "
  • 2 byte version "10"
  • 2 byte data type: 0 (ETC1_RGB_NO_MIPMAPS)
  • 16 bit big endian extended width
  • 16 bit big endian extended height
  • 16 bit big endian original width
  • 16 bit big endian original height
  • data, 64 bit big endian words.

From Game Developers SE Question

  • PKM format for ETC1 texture (All OGLES 2.0 devices compatibles)
  • PKM is useful for packaging ETC1-compressed images, but like with PNG, it doesn't support actual texture features.

Upvotes: 4

westman379
westman379

Reputation: 713

File format:

// PKM file format

// header  (16 bytes)
4 bytes (char) - signature // "PKM "
2 bytes (char) - version // "10 or "20"
2 bytes (uint16) - image type  // e.g. 0 - ETC1_RGB_NO_MIPMAPS
2 bytes (uint16) - image width
2 bytes (uint16) - image height
2 bytes (uint16) - original image width
2 bytes (uint16) - original image height

x bytes - image data

Some tools to handle PKM files:

ARM Texture Compression Tool
Ericsson's texture compression tool (ETCPACK)
Noesis (native support by "fmt_etc_pkm.py")

Upvotes: 1

Zoltan Karpati
Zoltan Karpati

Reputation: 184

You can convert the "PKM 10" format .pkm files to .png format using the following program: https://forum.ragezone.com/f857/pkm-encrypt-decrypt-convert-to-1179253/

Upvotes: -1

Jaiden Snow
Jaiden Snow

Reputation: 852

It seems like you met this image format: https://community.arm.com/thread/3968

It has PKM 10 in the beginning

Upvotes: 1

Related Questions