Understanding PNG and GIF File Formats for Raster Images
110 likes | 209 Views
Learn about PNG and GIF file formats for raster images, including transparency features, color support, compression methods, interlacing techniques, and chunk structures. Explore essential technical details and differences.
Understanding PNG and GIF File Formats for Raster Images
E N D
Presentation Transcript
Dateiformate für Rasterbilder .gif .png
GIF Graphics Interchange Format Compuserve, 1987-89 Palettenbilder mit max. 256 EinträgenMehrere TeilbilderLZW-Komprimierung (Patent Unisys)Transparenz (1 Stufe)1D-Interlacing Say „ping“ ! Portable Network Graphics PNG spec 1.0 released as Informational RFC 2083 (IETF) www.cdrom.com/pub/png KompressionVariable Transparenz2D-Interlacing Farbraum-Unterstützung RGB-BilderGraustufenbilderPalettenbilder
Progressiver Bildaufbau PNG Transparenz Alpha-Kanal: Maß der Deckkraft RGBAals 4. Byte A=0 durchsichtigA=2Bittiefe-1 opak Alpha-Kanal des GIF-Formatesordnet jedem Pixel das AttributTransparent / nicht transparentzu. Alpha-Kanal des PNG-Formatesordnet jedem Pixel Deckkraft zu. Korrekter Schatten auf jedem Hintergrund !
PNG Transparenz
PNG Reihenfolge desErscheinens derPixel „Adam7“ ProgressivitätInterlacing 1 6 4 6 2 6 4 6 7 7 7 7 7 7 7 7 5 6 5 6 5 6 5 6 7 7 7 7 7 7 7 7 3 6 4 6 3 6 4 6 7 7 7 7 7 7 7 7 5 6 5 6 5 6 5 6 7 7 7 7 7 7 7 7 • Gif-Interlacing1. Schritt: jede 8. Zeile, Start: 0 2. Schritt: jede 8. Zeile, ab 4 3. Schritt: jede 4. Zeile, ab 2 4. Schritt: alle ungeraden
PNG: Dateistruktur Alle Bytes in Network Byte Order (Little Endian)Alle Integer-Werte 31 Bit, höchstes 0 137 80 78 71 13 10 26 10 (dezimal) \211 P N G \r \n \032 \n PNG-Signatur: „Chunks“ IEND Daten CRC Länge Typ I H D R
PNG: Chunks Color type1 Bild hat Palette2 Bild hat Farbe4 Bild hat Alphakanal sinnvolle Kombinationen0,2,3,4,6 IHDR 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 Bittiefen:1,2,4,8,16 für Graustufen1,2,4,8 für Palettengröße8,16 für RGB, RGBA, Grau+A Filter:verlustfreie Transformation pro Zeilez.B. Differenz zum Vorgängerpixel Compression 0:ähnlich LZ77 (zip, gzip, pkzip)zlib, RFC 1950
PNG: Chunks PLTE:Bis zu 256 8 oder 16-Bit tiefe RGB-Werte IDAT: Zeilenweise,vor jeder Zeile Filterbyte (None = 0), komprimiert mit zlib. gAMA:sample = lightout^gammasample, lightout [0..1] 4 Byte Gamma-Wert, interpretiertals Gamma*100.000Beispiel: 1/2.2 = 45455 cHRM: (Chroma) Weißpunkt (x,y) nach CIERot (x,y)Grün (x,y)Blau (x,y)x,y als 4 Byte Festkommazahlenmit 5 Dezimalen
PNG: Chunks • tRNS:Für einfache Transparenz,besteht aus (je nach Bildart) • einem Farbwert für Truecolor-Bilder • einem Grauwert für Graufstufenbilder • einer Alpha-Palette, die jederPalettenfarbe einen Alpha-Wertzuordnet. sRGB: (1 Byte)0: Perceptual1: Relative colorimetric2: Saturation3: Absolute colorimetric Weitere Chunks pHYs (Pixelgröße) sPLT (suggested Palette) sBIT (signifcant Bits) tIME (Zeit) iTXT (international Text) sKGD (Background) tEXtzTXT (zipped text) hIST (histogramm) iCCP (color profile) pivate Chunks
sRGB: Standard RGB Color Space Vereinfachtes Color-Management fürs WEB Idee: Farbwerte so wählen, dass sie bei typischem Monitorin typischer Umgebung ungeändert übernommen werdenkönnen, um optimale Wiedergabe zu gewährleisten. TypischeUmgebung: 200 luxBeleuchtungD50 Weißpkt. ITU-R BT.709 Fernsehstandard: Monitor-Gamma 2.2 AbsoluteDefinitionauf BasisCIE TypischerMonitor: 80 cd/m2D65 Weißpkt. Monitor-/ Betrachter-Eigenschaften: dunkle Werte linear, darüber Gamma 2,4 Rot Grün Blau D65 x 0.6400 0.3000 0.1500 0.3127y 0.3300 0.6000 0.0600 0.3290z 0.0300 0.1000 0.7900 0.3583
sRGB: Standard RGB Color Space Nichtlineare RGB-Werte R‘, G‘, B‘ White Digital CountBlack Digital Count