Einzelnen Beitrag anzeigen

HolgerX

Registriert seit: 10. Apr 2006
Ort: Leverkusen
961 Beiträge
 
Delphi 6 Professional
 
#3

AW: Bit-Tiefe in PNG ermitteln

  Alt 26. Mär 2020, 18:59
Hmm..

Das Image als FileStream öffnen und dann nach dem Header (signature) den Chunk 'IHDR' suchen.

http://www.libpng.org/pub/png/spec/1...Structure.html
http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html

Zitat:
The IHDR chunk must appear FIRST. It contains:

Width: 4 bytes
Height: 4 bytes
Bit depth: 1 byte
Color type: 1 byte
Compression method: 1 byte
Filter method: 1 byte
Interlace method: 1 byte
Width and height give the image dimensions in pixels. They are 4-byte integers. Zero is an invalid value. The maximum for each is 231 in order to accommodate languages that have difficulty with unsigned 4-byte values.

Bit depth is a single-byte integer giving the number of bits per sample or per palette index (not per pixel). Valid values are 1, 2, 4, 8, and 16, although not all values are allowed for all color types.

... und dann hast Du hier schon deine Bit depth...
(Ja ich Verwende Delphi 6 Pro und will NICHT wechseln!)
  Mit Zitat antworten Zitat