Graphics File Formats Graphics File Formats Terminology Bitmaps PBM

Graphics File Formats Graphics File Formats Terminology Bitmaps PBM

Graphics File Formats • Why have graphics file formats? • What to look for when choosing a file format • A sample tour of different file formats, including – bitmap-based formats – vector-based formats – metafiles – proprietary formats – fractal compression formats The Graphics File Format Page The Graphics File Formats FAQ (see online references) 1 2 Graphics File Formats Terminology • Need to store and retrieve graphical data in an (…or what to look out for in file formats) efficient and logical way • Data stored according to specific format conventions When choosing which is more appropriate for your • Formats are immortal - technology evolves, new purpose, some common factors to consider: formats appear, but the old ones will still be there! • Lossy or lossless compression? • No one universal format - different formats for • What is the compression ratio in this case? different purposes • 8-bit or 7-bit (binary or text)? • You (probably) won’t need to access the formats in • Is it stored at a fixed resolution? detail • How many images per file (static or animated)? – there is library code to input/output/convert images for you! – useful to understand what is going on “behind the scenes”, • ….amongst other things for making the best image format choices 3 4 Bitmaps PBM, PGM, PPM Simplified structure of a bitmap file: • Family of portable bitmaps • Designed to be as simple as possible! • Written in ASCII • No compression • 1 image per file In practice there are many format variations 5 6 1 PBM PGM • Portable Bit Map • Portable Grey Map • For monochrome images P1 P2 # feep.pgm # feep.pbm 24 7 24 7 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 0 0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0 0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 8 PPM BMP • Standard bitmap storage format for Microsoft • Portable Pix Map Windows (also supported by some other non- Microsoft applications) – Never meant to be portable – Nor meant for a data interchange format across P3 different operating systems # sq.ppm • 1 image per file 4 4 • Uses RLE (run-length encoding) 15 – therefore uses lossless compression 0 0 0 0 0 0 0 0 0 0 0 15 – original bitmap did not support compression! 0 0 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 • Huge file sizes! 0 0 15 0 0 0 0 0 0 0 0 0 – e.g. sample 470x682 photo stored as 40.3K JPG file is a 963K BMP file 9 10 BMP GIF • Graphics Interchange Format (1987 and 1989 versions) – The format specification says it is to be pronounced “jif” • Uses a palette of up to 256 colours – not good for photographs, but great for text/diagrams • Uses LZW compression of the bitmap data – causes copyright problems (Unisys patent)! – reasonably easy to read and decompress • Supports multiple images (animation!!) • 1989 version supports transparency and interlacing – At most one colour in the palette may be declared transparent 11 12 2 Interlacing of Pixel Data GIF Row Number Interlace Pass 0 ----------------------------------------- 1 1 ----------------------------------------- 4 2 ----------------------------------------- 3 3 ----------------------------------------- 4 4 ----------------------------------------- 2 5 ----------------------------------------- 4 6 ----------------------------------------- 3 7 ----------------------------------------- 4 8 ----------------------------------------- 1 9 ----------------------------------------- 4 10 ----------------------------------------- 3 11 ----------------------------------------- 4 12 ----------------------------------------- 2 13 ----------------------------------------- 4 14 ----------------------------------------- 3 15 ----------------------------------------- 4 16 ----------------------------------------- 1 17 ----------------------------------------- 4 18 ----------------------------------------- 3 19 ----------------------------------------- 4 13 14 Interlacing PNG • Portable Network Graphics – informally known as “PNG Not GIF” – pronounced “ping” • Successor to GIF (lossless but free) • Not a restricted palette - up to 48-bit truecolour • Supports transparency, interlacing, but not animation – animation available in a related format, MNG • Transparency through an alpha channel – also supports anti-aliasing • Compression marginally better than GIFs, based on LZ77 (earlier than LZW) 15 16 JFIF TIFF • Tag Image File Format • JFIF - JPEG File Interchange Format • Designed primarily for desktop publishing and related • There is no JPEG format! applications • JPEG more commonly refers to the compression • Contains lots of tags in the file, identifying different algorithms used types of content – typically between 10:1 and 20:1 for photographs • Rationale behind using tags is that it is easier to • Basically a data stream with a few restrictions and incorporate new features in future versions of the identifying markers format without confusing old software, or making old TIFF images useless • Very complex! 17 18 3 FIG FIG Example • Facility for Interactive Generation of figures #FIG 3.2 FIG: 227bytes • Proprietary vector format for xfig drawing program Landscape GIF: 1.49kb Center • ASCII text file PNG: 2.12kb Inches JPG: 6.42kb Letter 100.00 Single -2 1200 2 1 3 0 1 6 6 10 0 20 0.000 1 0.0000 3976 2992 1665 1665 3976 2992 5641 2992 2 2 0 1 4 4 100 0 20 0.000 0 0 -1 0 0 5 600 675 4500 675 4500 3450 600 3450 600 675 19 20 CGM POVRay • Computer Graphics Metafile • POVRay is a 3D computer graphics rendering • Three different encodings program – One for minimal size/ease of transmission – it has its own proprietary 3D scene-based format, looks like program code – Binary encoded for speed of access – e.g. – Clear text encoding for human readability/editing • Primarily vector graphics, but also bitmap data • An ISO standard 21 22 global_settings { assumed_gamma 2.2 } VRML plane { y, 0 • Virtual Reality Modelling Language #include "colors.inc" pigment { Tan } #include "shapes.inc" finish { • Interactive 3D worlds: browser plugins available #include "textures.inc" crand 0.015 #include "stones.inc" ambient 0.12 diffuse 0.8 camera { } location <0, 45, -40> } direction <0, 0, 1.5> look_at <0, 0, 0> cylinder { } <0, -4, 0>, <0, 4, 0>, 2.5 light_source { translate <-7, 4, -8> <30, 20, -10> texture { T_Stone18 } color White } area_light <4, 0, 0>, <0, 0, 4>, 9, 9 } 23 24 4 VRML Code FIF #VRML V1.0 ascii Separator { DirectionalLight { • FIF (Fractal Image Format) direction 0 0 -1 # Light shining from viewer into scene } • Barnsley (and later, Jacquin) developed the PerspectiveCamera { compression technique position -8.6 2.1 5.6 orientation -0.1352 -0.9831 -0.1233 1.1417 • Commercial format by Iterated System Inc. focalDistance 10.84 } • Suffers from over-hype and commercialization Separator { # The red sphere Separator { # The blue cube – claims of several thousand to one compression ratios Material { Material { diffuseColor 1 0 0 # Red diffuseColor 0 0 1 # Blue • Realistic compression ratios range from 4:1 to 100:1 } } Translation { translation 3 0 1 } Transform { • FIF good for most pictures, particularly Sphere { radius 2.3 } translation -2.4 .2 1 photographs/scenes, with elements of self-similarity } rotation 0 1 1 .9 } (not difficult!) Cube {} } 25 26 Comparison of Images Comparison Table raw data 100% 100% 100% PPM 407% 406% 406% BMP 100% 33% 33% 624 ´ 453 pixels GIF 19% 18% 1% PNG 32% 16% 1% 1024 ´ 768 pixels TIFF (LZW) 111% 18% 1% JPEG 5% 5% 10% FIF 5% 6% 3% 600 x 401 pixels 27 28 End of Lecture Next three lectures will look at sound (lecture on compression and file formats for moving images will be delivered later!) 29 5.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    5 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us