File format | BMP | GIF | PNG | JPEG | TIFF | PCX | TGA |
---|---|---|---|---|---|---|---|
Max colors | 16M | 256 | 256T | 16M | 16M | 16M | 16M |
Max shades of gray | 256 | 256 | 65536 | 256 | 256 | 256 | 256 |
Color modes | 2, 16, 256, 32768, 65536, 16M | 2, 4, 8, 16, 32, 64, 128, 256 | 2, 4, 16, 256, 16M, 256T | 16M | 16, 256, 16M | (4), (8), 16, 256, 16M | 256, 65536, 16M |
Low-color modes | 2, 16, 256 | 2, 4, 8, 16, 32, 64, 128, 256 | 2, 4, 16, 256 | — | 16, 256 | (4), (8), 16, 256 | 256 |
High-color modes | 32768, 65536, 16M | — | 16M, 256T | 16M | 16M | 16M | 65536, 16M |
Gray modes | — | — | 2, 4, 16, 256, 65536 | 256 | 2, 256, 65536 | 2 | 2, 256 |
Monochrome modes | 2 colors | 2 colors | 2 colors or B&W | — | B&W | B&W | B&W |
Compression | None, RLE (16/ | LZW | Deflate | JPEG | None, CCITT (B&W), PackBits, LZW, JPEG | RLE | None, RLE |
Transparency (optional) | None | Single color | Single color, Alpha | None | None | None | None |
Interlacing (optional) | None | Line order | Pixel order | Progressive | None | None | None |
Multiple images | No | Yes, animated | No | No | Yes, pages | No | No |
Max pixels | 2G | 64K | 2G | 64K | 4G | 64K | 32K |
Textual metadata | None | Comments | Keyword = value pairs | Comment, EXIF, IPTC | Pre-defined fields, EXIF, IPTC | None | Pre-defined fields |
Numeric metadata | None | None | Yes | EXIF, IPTC | EXIF, IPTC | None | Yes |
Extensible | No | Yes | Yes | No | Yes | No | Yes |
Bits | Colors | Description | Common uses |
---|---|---|---|
1 | 2 | Monochrome. B&W or any 2 colors. | Icons, cursors |
2 | 4 | ||
3 | 8 | ||
4 | 16 | Color palette or grayscale palette | Icons |
5 | 32 | ||
6 | 64 | ||
7 | 128 | ||
8 | 256 | Color palette or full grayscale | Drawings, icons, grayscale images |
15 | 32768 | ||
16 | 65536 | Sometimes called "High Color" | |
24 | 16M | 16 million colors, "True Color" | Photos |
48 | 256T | 256 teracolors | Scans, scientific images |
Kompresi
Data gambar dapat dikompres untuk menghemat memori dan bandwidth. Mode kompresi berikut dapat ditemukan dalam format gambar yang dimaksud:
- Tidak ada Beberapa format file mendukung mode tidak terkompresi, yang berarti bit mentah disimpan persis atau sangat dekat dengan cara mereka muncul di layar.
- Kompresi RLE (Run-Length Encoding) mendeteksi proses terus menerus dari satu warna dan mengemasnya dalam beberapa bit atau byte. Variasi yang berbeda untuk ide itu ada. Secara khusus, format TIFF mendukung dua metode kompresi RLE alternatif: PackBits dan CCITT. Kompresi CCITT hadir dalam tiga varian dan hanya tersedia untuk gambar hitam putih. RLE bekerja dengan baik untuk gambar dengan lintasan panjang yang berdekatan dari satu warna dalam arah horizontal. Ini berarti RLE biasanya bekerja dengan baik untuk gambar monokrom atau warna-rendah. RLE tidak cocok untuk foto.
- LZW (Lempel – Ziv – Welch) adalah algoritma adaptif yang mencari gerakan horizontal berulang dalam gambar. Alih-alih hanya mengemas berjalan terus menerus dari satu warna, itu dapat secara efektif mengemas jenis pengulangan lainnya juga. Di satu sisi, LZW "belajar" gambar saat kompres itu. Setelah menemukan lokasi berulang, itu menghasilkan referensi ke pengulangan daripada menyimpan piksel yang sama berulang-ulang. Perlu dicatat bahwa sementara GIF dan TIFF mendukung LZW, ada perbedaan yang halus dalam algoritma kompresi. Khususnya, GIF memberikan kompresi yang efektif untuk gambar kecil dengan kedalaman bit rendah.
- Deflate adalah algoritma kompresi yang digunakan oleh PNG. Deflate menggunakan kompresi LZ77 yang dikodekan dengan kode Huffman. Agar Deflate berjalan lebih efisien, PNG mendukung langkah filter sebelum kompresi yang sebenarnya. Pemfilteran tidak mengubah gambar. Alih-alih, ini mengubah nilai numerik piksel menjadi piksel yang kompresnya lebih baik. Kombinasi teknik-teknik ini membuat PNG lebih unggul daripada format terkompresi LZW. PNG menghasilkan file yang lebih kecil untuk banyak gambar, terutama yang dengan slide warna, dan juga untuk foto.
- JPEG adalah algoritma kompresi lossy yang dirancang untuk foto. JPEG efektif untuk gambar berwarna dan skala abu-abu. Ini didukung oleh format file JPEG dan TIFF. Menerapkan kompresi JPEG ke non-foto dapat menghasilkan kualitas rendah dan file besar. Kesalahan umum adalah menyimpan gambar dalam format JPEG.
Jadi, format file dan metode kompresi mana yang memberikan ukuran file terkecil? Itu tergantung pada jenis gambar. Kami menguji ini dengan menyimpan gambar yang sama dalam format file yang berbeda. Dalam setiap kasus, kami menggunakan kompresi maksimum yang tersedia bersama dengan mode warna serendah mungkin. Untuk JPEG kami menggunakan kompresi maksimum tanpa artefak yang terlihat pada tingkat zoom 1:1
Test image | BMP | GIF | PNG | JPEG | TIFF (compressed) | PCX | TGA |
---|---|---|---|---|---|---|---|
16M-color photo | 43 kB | — | 27 kB | 7 kB | 44 kB (PackBits) | 42 kB | 43 kB |
256-gray photo | 16 kB | 14 kB | 10 kB | 6 kB | 15 kB (LZW) | 15 kB | 16 kB |
256-color screenshot | 62 kB | 25 kB | 14 kB | 109 kB | 30 kB (LZW) | 54 kB | 57 kB |
3-color flag | 1286 B | 125 B | 132 B | 1243 B | 1926 B (Packbits) | 448 B* | 954 B |
Monochrome drawing | 2990 B | 887 B | 745 B | 6727 B | 1274 B (CCITT | 2380 B | 2604 B |
*) The 3-color PCX file was saved in a 16-color format, even though a lower color mode is available, due to limitations in the software at hand.
Perbedaan file gambar JPG PSD PNG TIFF BMP dan GIF serta DNG
Dari foto sampai gambar animasi, mengunakan beberapa format file.
Technical details
Format Compression
algorithm Raster/
vector Color depth Indexed color Transparency Metadata Interlacing Multi-page Animation[9] Layers Color management Extendable HDR format
AI Lossy and lossless Both 1, 8, 24, and 32 (possibly with multiple palettes) Yes Yes Yes No Yes No Yes Yes Unknown No
BMP None, RLE, JPEG, and PNG Raster 1, 4, 8, 16, 24, 32, and 64 Yes Yes No No No No No Yes No No
BPG HEVC, Lossy and lossless Raster 8 to 14 bits per channel No Yes Yes No No Yes Unknown Yes Unknown Unknown
CDR Lossy and lossless Both 1, 8, 24,and 32 (multiple palettes) Yes Yes Yes No Yes No Yes Yes Unknown No
CPC CPC Raster 1 No No Yes No Yes No No No Yes, via embedded dictionary No
EPS None, LZW, DEFLATE, RLE, DCT Both Device specific No Yes Yes N/A Yes No Yes Yes Yes Yes
EXR None, RLE, ZIP, Piz, PXR24, and B44, B44A, DWAA, DWAB Raster 16–128 (floating-point) No Yes Yes No Yes No Yes Yes Yes Yes
Farbfeld None Raster 64 (16-bits-per-channel) No Yes No No No No No No No No
FLIF Lossless, MANIAC entropy coding Raster 1 to 16 bits per channel Yes Yes Yes Yes, Adam∞ No Yes No Yes Yes, via chunks Yes, with suitable color profile
GIF LZW Raster Indexed (1bpc to 8bpc) and grayscale (8bpc) Yes Yes; 1bpp plane-only mask using color index Yes Yes Yes Yes Yes No Yes (GIF89a) No
HD Photo / JPEG XR Lossy and lossless bi-orthogonal transform Raster 1, 2, 8, 16, 24, 32, 48, 64, and 128 (floating-point) No Yes Yes Yes Yes No No Yes Yes Yes
ILBM Optional run-length encoding Raster 1, 2, 4, 8, 16, 32, 64, 64 EHB, 128, 256 (8-bit), 4,096 (HAM6 pseudo 12-bit), 4,096 pure 12-bit, 262, 144 (HAM8 pseudo 18-bit), and 24-bit Yes No Yes Yes No Yes,
Palette-shifting No No Yes No
IMA Lossy and lossless original mutiresolution analysis transformation Raster 8-bit, 16-bit integer, 32-bit floating-point No Yes Yes No No No No Yes Yes Yes
JPEG Lossy (and partly lossless), DCT, RLE, and Huffman predictive nearest neighbor Raster 8-bit (greyscale), 12-bit, and 24-bit No No Yes Yes No No No Yes No No (see unofficial JPEG-HDR)
JPEG 2000 Lossy and lossless (DWT) Raster 8 and 16 (greyscale) with possibly color up to 48-bit No Yes Yes Yes No No No Yes Unknown No
KRA None Both grayscale, RGB, XYZ (8bpc, 16bpc, float16bpc, float32bpc), CMYK, L*a*b* and YCbCr (8bpc, 16bpc, float32bpc) No Yes Yes No Yes Yes Yes Yes Yes Yes
ORA Lossless Both 1, 2, 4, 8, 16, 24, 32, 48, and 64 Yes Yes Yes Yes Yes No Yes Yes Yes Yes
PAM None Raster Up to 16 No Yes Yes No Yes No No No Yes No
PCX None, RLE Raster 1, 2, 4, 8, 24 and 32 Yes Yes No No Yes No No No No No
PGF Lossy and lossless (DWT) Raster grayscale: 1, 8, 16, 31; RGB: 12, 16, 24, 32, and 48 Yes Yes Yes Yes No No No No Unknown No
PICT None, RLE, and QuickTime Both 1, 2, 4, 8, 16, 24, and 32 Yes Yes Yes Unknown No No No Unknown No? No
PLD Optional ZIP, JPEG Both 1, 4, 8, 16, 24, 32, 48, and 64 Unknown Yes Yes Unknown Yes Yes Yes Yes Yes Yes
PNG Lossless and DEFLATE Raster bitmap (1bpc), indexed (8bpc), grayscale and RGB (8bpc, 16bpc) Yes Yes; indexed, grayscale and RGB Yes Yes, Adam7 algorithm No No (but see MNG and APNG) No Yes Yes, via chunks No, see discussion
PPM None Raster Up to 16 No No Yes No Yes No No No No No
PSD and PSB None and RLE Both bitmap (1bpc), duotone, indexed (8bpc), grayscale, RGB, CMYK, Lab and multichannel (8bpc, 16bpc, 32bpc) Yes Yes; indexed, grayscale, RGB, CMYK and Lab Yes N/A No Yes Yes Yes No? Yes
PSP None Both 1, 2, 8, 16, 24, 32, and 48 Yes Yes; 8b and 16b per-pixel alpha channel Yes No Unknown No Yes Unknown Unknown No
SVG None and lossless gzip Vector[10] RGB (8bpc) No Yes Yes N/A Yes (1.2 draft)[11] Yes (SMIL/SVG) Yes Yes[12] Yes, XML based N/A
TGA None, RLE, and other Raster 1, 2, 4, 8, 16, 24, and 32 Yes Yes Yes No No No No No Unknown No
TIFF None, LZW, RLE, ZIP, and other Both 1, 2, 4, 8, 16, 24, and 32 Yes (1–8 bit modes) Yes Yes Yes, for JPEG compression Yes No Yes Yes Yes, via tags Yes, TIFF float
WebP Lossy and lossless Raster YUV420P (12bpp), YUVA420P (20bpp) and RGB (8bpc) No Yes Yes No Yes Yes No Yes Yes No
XAML None Vector 32 and 64 No Yes Yes N/A Yes Yes Yes No Yes Yes
XCF None and lossless (gzip, bzip2 and xz) Both indexed (8bpc), grayscale and RGB (8bpc, 16bpc, float16bpc, 32bpc, float32bpc, float64bpc) Yes Yes Yes No No Yes Yes Yes Yes Yes
Format Compression algorithm Raster/
vector Color depth Indexed color Transparency Metadata Interlacing Multi-page Animation Layers Color management Extendable HDR format
Format | Compression algorithm | Raster/ vector | Color depth | Indexed color | Transparency | Metadata | Interlacing | Multi-page | Animation[9] | Layers | Color management | Extendable | HDR format |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
AI | Lossy and lossless | Both | 1, 8, 24, and 32 (possibly with multiple palettes) | Yes | Yes | Yes | No | Yes | No | Yes | Yes | Unknown | No |
BMP | None, RLE, JPEG, and PNG | Raster | 1, 4, 8, 16, 24, 32, and 64 | Yes | Yes | No | No | No | No | No | Yes | No | No |
BPG | HEVC, Lossy and lossless | Raster | 8 to 14 bits per channel | No | Yes | Yes | No | No | Yes | Unknown | Yes | Unknown | Unknown |
CDR | Lossy and lossless | Both | 1, 8, 24,and 32 (multiple palettes) | Yes | Yes | Yes | No | Yes | No | Yes | Yes | Unknown | No |
CPC | CPC | Raster | 1 | No | No | Yes | No | Yes | No | No | No | Yes, via embedded dictionary | No |
EPS | None, LZW, DEFLATE, RLE, DCT | Both | Device specific | No | Yes | Yes | N/A | Yes | No | Yes | Yes | Yes | Yes |
EXR | None, RLE, ZIP, Piz, PXR24, and B44, B44A, DWAA, DWAB | Raster | 16–128 (floating-point) | No | Yes | Yes | No | Yes | No | Yes | Yes | Yes | Yes |
Farbfeld | None | Raster | 64 (16-bits-per-channel) | No | Yes | No | No | No | No | No | No | No | No |
FLIF | Lossless, MANIAC entropy coding | Raster | 1 to 16 bits per channel | Yes | Yes | Yes | Yes, Adam∞ | No | Yes | No | Yes | Yes, via chunks | Yes, with suitable color profile |
GIF | LZW | Raster | Indexed (1bpc to 8bpc) and grayscale (8bpc) | Yes | Yes; 1bpp plane-only mask using color index | Yes | Yes | Yes | Yes | Yes | No | Yes (GIF89a) | No |
HD Photo / JPEG XR | Lossy and lossless bi-orthogonal transform | Raster | 1, 2, 8, 16, 24, 32, 48, 64, and 128 (floating-point) | No | Yes | Yes | Yes | Yes | No | No | Yes | Yes | Yes |
ILBM | Optional run-length encoding | Raster | 1, 2, 4, 8, 16, 32, 64, 64 EHB, 128, 256 (8-bit), 4,096 (HAM6 pseudo 12-bit), 4,096 pure 12-bit, 262, 144 (HAM8 pseudo 18-bit), and 24-bit | Yes | No | Yes | Yes | No | Yes, Palette-shifting | No | No | Yes | No |
IMA | Lossy and lossless original mutiresolution analysis transformation | Raster | 8-bit, 16-bit integer, 32-bit floating-point | No | Yes | Yes | No | No | No | No | Yes | Yes | Yes |
JPEG | Lossy (and partly lossless), DCT, RLE, and Huffman predictive nearest neighbor | Raster | 8-bit (greyscale), 12-bit, and 24-bit | No | No | Yes | Yes | No | No | No | Yes | No | No (see unofficial JPEG-HDR) |
JPEG 2000 | Lossy and lossless (DWT) | Raster | 8 and 16 (greyscale) with possibly color up to 48-bit | No | Yes | Yes | Yes | No | No | No | Yes | Unknown | No |
KRA | None | Both | grayscale, RGB, XYZ (8bpc, 16bpc, float16bpc, float32bpc), CMYK, L*a*b* and YCbCr (8bpc, 16bpc, float32bpc) | No | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes |
ORA | Lossless | Both | 1, 2, 4, 8, 16, 24, 32, 48, and 64 | Yes | Yes | Yes | Yes | Yes | No | Yes | Yes | Yes | Yes |
PAM | None | Raster | Up to 16 | No | Yes | Yes | No | Yes | No | No | No | Yes | No |
PCX | None, RLE | Raster | 1, 2, 4, 8, 24 and 32 | Yes | Yes | No | No | Yes | No | No | No | No | No |
PGF | Lossy and lossless (DWT) | Raster | grayscale: 1, 8, 16, 31; RGB: 12, 16, 24, 32, and 48 | Yes | Yes | Yes | Yes | No | No | No | No | Unknown | No |
PICT | None, RLE, and QuickTime | Both | 1, 2, 4, 8, 16, 24, and 32 | Yes | Yes | Yes | Unknown | No | No | No | Unknown | No? | No |
PLD | Optional ZIP, JPEG | Both | 1, 4, 8, 16, 24, 32, 48, and 64 | Unknown | Yes | Yes | Unknown | Yes | Yes | Yes | Yes | Yes | Yes |
PNG | Lossless and DEFLATE | Raster | bitmap (1bpc), indexed (8bpc), grayscale and RGB (8bpc, 16bpc) | Yes | Yes; indexed, grayscale and RGB | Yes | Yes, Adam7 algorithm | No | No (but see MNG and APNG) | No | Yes | Yes, via chunks | No, see discussion |
PPM | None | Raster | Up to 16 | No | No | Yes | No | Yes | No | No | No | No | No |
PSD and PSB | None and RLE | Both | bitmap (1bpc), duotone, indexed (8bpc), grayscale, RGB, CMYK, Lab and multichannel (8bpc, 16bpc, 32bpc) | Yes | Yes; indexed, grayscale, RGB, CMYK and Lab | Yes | N/A | No | Yes | Yes | Yes | No? | Yes |
PSP | None | Both | 1, 2, 8, 16, 24, 32, and 48 | Yes | Yes; 8b and 16b per-pixel alpha channel | Yes | No | Unknown | No | Yes | Unknown | Unknown | No |
SVG | None and lossless gzip | Vector[10] | RGB (8bpc) | No | Yes | Yes | N/A | Yes (1.2 draft)[11] | Yes (SMIL/SVG) | Yes | Yes[12] | Yes, XML based | N/A |
TGA | None, RLE, and other | Raster | 1, 2, 4, 8, 16, 24, and 32 | Yes | Yes | Yes | No | No | No | No | No | Unknown | No |
TIFF | None, LZW, RLE, ZIP, and other | Both | 1, 2, 4, 8, 16, 24, and 32 | Yes (1–8 bit modes) | Yes | Yes | Yes, for JPEG compression | Yes | No | Yes | Yes | Yes, via tags | Yes, TIFF float |
WebP | Lossy and lossless | Raster | YUV420P (12bpp), YUVA420P (20bpp) and RGB (8bpc) | No | Yes | Yes | No | Yes | Yes | No | Yes | Yes | No |
XAML | None | Vector | 32 and 64 | No | Yes | Yes | N/A | Yes | Yes | Yes | No | Yes | Yes |
XCF | None and lossless (gzip, bzip2 and xz) | Both | indexed (8bpc), grayscale and RGB (8bpc, 16bpc, float16bpc, 32bpc, float32bpc, float64bpc) | Yes | Yes | Yes | No | No | Yes | Yes | Yes | Yes | Yes |
Format | Compression algorithm | Raster/ vector | Color depth | Indexed color | Transparency | Metadata | Interlacing | Multi-page | Animation | Layers | Color management | Extendable | HDR format |