Raster Images in R Graphics by Paul Murrell

Total Page:16

File Type:pdf, Size:1020Kb

Raster Images in R Graphics by Paul Murrell 48 CONTRIBUTED RESEARCH ARTICLES Raster Images in R Graphics by Paul Murrell Abstract The R graphics engine has new sup- 39837_s_at 1267_at 402_s_at 32562_at 37600_at 1007_s_at 36643_at 1039_s_at 40215_at 39781_at port for rendering raster images via the func- 266_s_at 307_at 38408_at 37539_at 1911_s_at 1463_at 2057_g_at 39556_at 41744_at 34789_at 34850_at rasterImage() grid.raster() 38631_at tions and . This 37280_at 36536_at 37006_at 41397_at 41346_at 40692_at 35714_at 1992_at 33244_at 40167_s_at 32872_at 34699_at 33440_at leads to better scaling of raster images, faster 36275_at 33809_at 40953_at 1308_g_at 1928_s_at 1307_at 40504_at 41742_s_at 41743_i_at 1674_at 40784_at 40785_g_at rendering to screen, and smaller graphics files. 37978_at 37099_at 1973_s_at 38413_at 2036_s_at 1126_s_at 31472_s_at 37184_at 35256_at 40493_at 41779_at 33412_at Several examples of possible applications of 37193_at 37479_at 39210_at 919_at 1140_at 41478_at 35831_at 176_at 37724_at 38385_at 41401_at 41071_at these new features are described. 39135_at 34961_at 37251_s_at 41470_at 1947_g_at 37810_at 36777_at 38004_at 177_at 36897_at 34106_at 31615_i_at 35665_at 33358_at 39315_at 41191_at 931_at 1914_at 36873_at 37809_at 39635_at 38223_at 33936_at 37558_at 41348_at 31605_at 205_g_at 32475_at 34247_at 36149_at 1500_at 34098_f_at 33528_at 35663_at 40393_at 33193_at 39716_at 33405_at 1929_at 36092_at 32215_i_at 41448_at 40763_at 873_at Prior to version 2.11.0, the core R graphics engine 37225_at 38056_at 37413_at 39424_at 32116_at 2039_s_at 40480_s_at 35816_at 1134_at 35260_at 39327_at 35769_at was entirely vector based. In other words, R was 33774_at 38032_at 34362_at 36650_at 41193_at 40088_at 40570_at 41266_at 36773_f_at 36878_f_at 41723_s_at 32977_at only capable of drawing mathematical shapes, such 38968_at 34210_at 37320_at 39717_g_at 36798_g_at 36398_at 40369_f_at 37967_at 32378_at 37043_at 41215_s_at 38096_f_at 36795_at as lines, rectangles, and polygons (and text). 675_at 1389_at 38095_i_at 38833_at 35016_at 676_g_at 41745_at 31508_at 1461_at 37420_i_at 37383_f_at 41237_at This works well for most examples of statistical 37039_at graphics because plots are typically made up of data 26008 04006 63001 28028 28032 31007 24005 19005 16004 15004 22010 24001 28019 30001 28021 15005 09008 11005 28036 62001 27003 26003 62002 65005 84004 03002 20002 12012 22013 37013 14016 27004 49006 24011 08011 62003 12026 31011 43001 24017 68003 12006 24010 24022 08001 12007 01005 symbols (polygons) or bars (rectangles), with axes (lines and text) alongside (see Figure1). Figure 2: An example of an inherently raster graph- 2.0 3.0 4.0 0.5 1.5 2.5 ● ● ● ical image: a heatmap used to represent microarray ● ● ● ● ● ●●● ●●●● ● ● ● Sepal.Length ●● ● ● ●●●● ● ● ● 7.5 ● ● ● ● ● ● ● ●●● ●●●●●●● ●● ● ● data. This image is based on Cock(2010); the data ● ●●● ● ●●●●● ●●● ●●● ●● ● ●●● ●●●●●● ●●● ●●●●●● ● ● ●●●●●● ● ● ●●● ●● ●●●●● ● ● ● ●● ●● ●● 6.5 ● ● ●●● ● ●●●●●●● ●● ●●●● ● ● ● ● ●● ● ● ●●●●●● ● ●● ● ●●●●●● ● ● ● ●●● ● ●●●●● ●● ●●● ● ●● ●● ● are from Chiaretti et al.(2004). ● ●●●● ●●●●● ● ● ● ● ● ●●●● ● ●● ● ● ● ●●●● ●●● ●● ● ● ●●●● ● ● ●● ● ● ●● ● ●● ● 5.5 ● ● ● ● ●●●●●●● ●●●●●●● ●●● ●●●●● ●● ●● ●● ● ● ●●●● ● ● ●●● ● ● ●● ● ● ●●●●● ●● ● ●● ● ●● ●● ● ● ● 4.5 ● ● ● Another minor problem is that some PDF view- ● ● ● ● ● ● ● ● ● ● Sepal.Width ● ● ● 4.0 ● ● ●● ●●●● ●● ●●● ● ● ●●● ● ● ● ● ●● ● ● ● ● ●● ● ers have trouble reconciling their anti-aliasing algo- ●●● ● ●●●● ●● ● ●●●●●● ●●● ●●●●● ● ●● ●●● ● ●● ●● ● ● ●● ● ●● ● ● ● ● ● ●●● ● ● ●● ●●●● ●●●● ●●●●● ●●● ● ●● ● ● ● ●●● ● ●● ●● ●●●●●●● ●● ●● ● ● ●● ●● ●●● ●●●●●● ●●●● ●● ●● ●●●● ●●●●●●●●●●●●●● ● ●●● ●●●●●●● ●●●● ● ●● ●●●●●● ● ● ● ●●●●● ● ● ● ●●● ● 3.0 ●●● ●●●●● ● ● ● ●● ●●●●●● ● ● ● ●●●● ●●●●● ● rithms with a large number of rectangles drawn side ● ●●● ●● ●●● ●●● ● ●●● ● ●● ●●● ● ● ● ● ● ● ● ● ● ● ● ●● ●●● ● ● ● ●● ● ●● ● ● ● ● ●●●● ● ● ● ●● ●● ● ● ● ● ● ● ● ● ● ● ● ●● ● ● ● ● ● by side and may end up producing an ugly thin line ● ● ● 2.0 ● ● ● 7 ●● ● ● ● ●●● between the rectangles. ● ● ● ● ● ● ● ●● ● ● ● ●● ● ●● ● ● ●●● ●● ● ● ● ● ● ●●● 6 ●●● ●● ● ●● ●●●● Petal.Length ● ● ●●●●● ●●● ●● ●● ● ● ● ● ●●● ● ● ● ●● ● ●●●● ●●●● ● ● ●● ●●● ●●●●●● ●● ● ●●●●● ●● ● ●● ●●● ●● ● ● 5 ●●●●● ● ●●●●●● ●●●●● ● ●●●● ●●●●●● ●● ●● ●●●●● ● ●●●●●● To avoid these problems, from R version 2.11.0 ●●● ●● ● ●● ●● ● ●●●●●● ●● ●●●● ● ● ●● ● ●● ● ● ●● ● 4 ● ● ●● ● ●● ● ● ● ● ● ●● ●● ● ● ● ● 3 on, the R graphics engine supports rendering raster ● ● ● ● ● ● 2 ●●●● ● ● ●●●●●● ●● ●●●●● ●●●●●●●●●●● ●●●●●●●●●● ●● ● ●●●● ●●● ● ●● ● ● ● ● ● ●● ●●● ● ● ● ● ●● 1 elements as part of a statistical plot. ● ● ● ● ● ●●● ● ● ● ● ● ● ● ● 2.5 ●● ●●● ● ● ●●● ● ●●●●●●● ● ●● ● ● ● ● ●● ● ● ●●●● ● ● ●● ● ●●●●● ● ●● ● ●● ● ● ● ● ● ●●●● ●● Petal.Width ● ●● ● ● ●● ●●● ● ●●●●●●●● ●● ● ●●●●●● ●●● ●●●●● ● ● ● ● ● ● ● ● ● ● ● ●● ●● ● ● ●● ●●●●●●●● ● ● ●●●●● ●●●●●●● ● ● ●●●● ●●●●●●● ● ●●●● ● 1.5 ●●● ●●●●● ● ● ●●●● ● ●●●●●●● ●●● ● ●●● ● ●●●●● ● ●● ●● ● ●● ●● ●●●● ● ●●● ●● ●●●●● ● ● ● ● ● ● ●● ● ● ● ●●● ● ●●●●● 0.5 ●●●●● ● ● ● ●● ● ●●●● ●●●●●●●●●●● ● ●●●●●●●●●● ● ● ●●●●●●●● ● ●● ● ●● ● ● ●●● Raster graphics functions 4.5 5.5 6.5 7.5 1 2 3 4 5 6 7 The low-level R language interface to the new Figure 1: A typical statistical plot that is well- raster facility is provided by two new func- described by vector elements: polygons, rectangles, tions: rasterImage() in the graphics package and lines, and text. grid.raster() in the grid package. For both functions, the first argument provides However, some displays of data are inherently the raster image that is to be drawn. This argument raster. In other words, what is drawn is simply an should be a "raster" object, but both functions will array of values, where each value is visualized as a accept any object for which there is an as.raster() square or rectangular region of colour (see Figure2). method. This means that it is possible to simply spec- It is possible to draw such raster elements using ify a vector, matrix, or array to describe the raster vector primitives—a small rectangle can be drawn image. For example, the following code produces a for each data value—but this approach leads to at simple greyscale image (see Figure3). least two problems: it can be very slow to draw lots of small rectangles when drawing to the screen; and > library(grid) it can lead to very large files if output is saved in a vector file format such as PDF (and viewing the re- sulting PDF file can be very slow). > grid.raster(1:10/11) The R Journal Vol. 3/1, June 2011 ISSN 2073-4859 CONTRIBUTED RESEARCH ARTICLES 49 new raster functions—the interpolate argument. In most cases, a raster image is not going to be rendered at its “natural” size (using exactly one de- vice pixel for each pixel in the image), which means that the image has to be resized. The interpolate argument is used to control how that resizing occurs. By default, the interpolate argument is TRUE, which means that what is actually drawn by R is a linear interpolation of the pixels in the original im- age. Setting interpolate to FALSE means that what gets drawn is essentially a sample from the pixels in Figure 3: A simple greyscale raster image generated the original image. The former case was used in Fig- from a numeric vector. ure3 and it produces a smoother result, while the lat- ter case was used in Figure4 and the result is more As the previous example demonstrates, a nu- “blocky.” Figure5 shows the images from Figures3 meric vector is interpreted as a greyscale image, with and4 with their interpolation settings reversed. 0 corresponding to black and 1 corresponding to white. Other possibilities are logical vectors, which are interpreted as black-and-white images, and char- acter vectors, which are assumed to contain either > grid.raster(1:10/11, interpolate=FALSE) colour names or RGB strings of the form "#RRGGBB". The previous example also demonstrates that a > grid.raster(matrix(colors()[1:100], ncol=10)) vector is treated as a matrix of pixels with a single column. More usefully, the image to draw can be specified by an explicit matrix (numeric, logical, or character). For example, the following code shows a simple way to visualize the first 100 named colours in R. > grid.raster(matrix(colors()[1:100], ncol=10), + interpolate=FALSE) Figure 5: The raster images from Figures3 and4 with their interpolation settings reversed. The ability to use linear interpolation provides another advantage over the old behaviour of draw- ing a rectangle per pixel. For example, Figure6 Figure 4: A raster image generated from a character shows a greyscale version of the R logo image drawn matrix (of the first 100 values in colors()). using both the old behaviour and with the new raster support. The latter version of the image is smoother It is also possible to specify the raster image as a thanks to linear interpolation. numeric array: either three-planes of red, green, and blue channels, or four-planes where the fourth plane provides an “alpha” (transparency) channel. > download.file("http://cran.r-project.org/Rlogo.jpg", Greater control over the conversion to a "raster" + "Rlogo.jpg") object is possible by directly calling the as.raster() > library(ReadImages) function, as shown below. > logo <- read.jpeg("Rlogo.jpg") > grid.raster(as.raster(1:10, max=11)) > par(mar=rep(0, 4)) Interpolation > plot(logo) The simple image matrix example above demon- strates another important argument in both of the > grid.raster(logo) The R Journal Vol. 3/1, June 2011 ISSN 2073-4859 50 CONTRIBUTED RESEARCH ARTICLES > plot(x, y, ann=FALSE,
Recommended publications
  • Understanding Image Formats and When to Use Them
    Understanding Image Formats And When to Use Them Are you familiar with the extensions after your images? There are so many image formats that it’s so easy to get confused! File extensions like .jpeg, .bmp, .gif, and more can be seen after an image’s file name. Most of us disregard it, thinking there is no significance regarding these image formats. These are all different and not cross‐ compatible. These image formats have their own pros and cons. They were created for specific, yet different purposes. What’s the difference, and when is each format appropriate to use? Every graphic you see online is an image file. Most everything you see printed on paper, plastic or a t‐shirt came from an image file. These files come in a variety of formats, and each is optimized for a specific use. Using the right type for the right job means your design will come out picture perfect and just how you intended. The wrong format could mean a bad print or a poor web image, a giant download or a missing graphic in an email Most image files fit into one of two general categories—raster files and vector files—and each category has its own specific uses. This breakdown isn’t perfect. For example, certain formats can actually contain elements of both types. But this is a good place to start when thinking about which format to use for your projects. Raster Images Raster images are made up of a set grid of dots called pixels where each pixel is assigned a color.
    [Show full text]
  • Graphic File Preparation for Letterpress Printing ©2016
    GRAPHIC FILE PREPARATION FOR LETTERPRESS PRINTING ©2016, Smart Set, Inc. COMMON GRAPHIC FILE FORMATS Vector Formats .ai (Adobe Illustrator) Native Illustrator file format. Best format for importing into Adobe InDesign. Illustrators’s native code is pdf, so saving files in .ai contains the portability of pdf files, but retaining all the editing capabilities of Illustrator. (AI files must be opened in the version of Illustrator that they were created in (or higher). .pdf (Adobe Portable Document Format) A vector format which embeds font and raster graphics within a self-con- tained document that can be viewed and printed (but not edited) in Adobe’s Reader freeware. All pre-press systems are in the process of transitioning from PostScript workflows to PDF workflows. Because of the ability to em- bed all associated fonts and graphics, pdf documents can be generated from most graphics software packages and can be utilized cross-platform and without having all versions of different software packages. Many large printers will now only accept pdf files for output. .eps (Encapsulated PostScript) Before Adobe created the pdf format, PostScript allowed files to be created in a device-independent format, eps files printed on a 300 dpi laser printer came out 300 dpi, the same file printed to an imagesetter would come out at 2540 dpi. PostScript files are straight code files, an Encapsulated PostScript includes a 72 dpi raster preview so that you can see what you’re working with in a layout program such as Quark XPress or InDesign. COMMON GRAPHIC FILE FORMATS Raster Formats .tiff (Tagged Image File Format) Tiffs are binary images best for raster graphics.
    [Show full text]
  • Image Formats
    Image Formats Ioannis Rekleitis Many different file formats • JPEG/JFIF • Exif • JPEG 2000 • BMP • GIF • WebP • PNG • HDR raster formats • TIFF • HEIF • PPM, PGM, PBM, • BAT and PNM • BPG CSCE 590: Introduction to Image Processing https://en.wikipedia.org/wiki/Image_file_formats 2 Many different file formats • JPEG/JFIF (Joint Photographic Experts Group) is a lossy compression method; JPEG- compressed images are usually stored in the JFIF (JPEG File Interchange Format) >ile format. The JPEG/JFIF >ilename extension is JPG or JPEG. Nearly every digital camera can save images in the JPEG/JFIF format, which supports eight-bit grayscale images and 24-bit color images (eight bits each for red, green, and blue). JPEG applies lossy compression to images, which can result in a signi>icant reduction of the >ile size. Applications can determine the degree of compression to apply, and the amount of compression affects the visual quality of the result. When not too great, the compression does not noticeably affect or detract from the image's quality, but JPEG iles suffer generational degradation when repeatedly edited and saved. (JPEG also provides lossless image storage, but the lossless version is not widely supported.) • JPEG 2000 is a compression standard enabling both lossless and lossy storage. The compression methods used are different from the ones in standard JFIF/JPEG; they improve quality and compression ratios, but also require more computational power to process. JPEG 2000 also adds features that are missing in JPEG. It is not nearly as common as JPEG, but it is used currently in professional movie editing and distribution (some digital cinemas, for example, use JPEG 2000 for individual movie frames).
    [Show full text]
  • About Graphics/Digital Images
    About Graphics/Digital Images Digital images are found in lots of file formats (types) that are used for various reasons. I liken the file formats to flavors of ice-cream, which you might or might not choose to consume on any given day. One day chocolate is more important than mint; another day you might use vanilla, and on another day you might decide to combine more than one flavor in the same bowl. Likewise, you might choose one type of graphic file for a particular project, but it might be completely inappropriate for another project. What works well for display purposes (keeping it on the computer, or for publication to the internet) might not print well. Something that prints well might be too big a file to post to the internet, or may make your program run too slowly. Also, some authoring programs (like Boardmaker or Classroom Suite) might be written to only understand certain types of image files. Some file types are more common than others, and are more likely to be recognized by the “parent” program (the one you use to display, edit or print your image). Whatever type you pick ultimately depends on how you plan to use the image. The more technical definitions provided below are taken from the glossary found at http://www.photoshopelementsuser.com/glossary.php?letter=B The additional comments I have added, and hopefully let you know why you would care about any of this, anyway. The two biggest types of images I describe here fall loosely into two categories: vector images and bitmap images.
    [Show full text]
  • LO1: Investigating Digital Graphics
    Name: Freya Ellis Candidate Number: 5068 Centre Number: 29335 Series: June 2019 R082 – Creating a Digital Graphic LO1: Investigating Digital Graphics Purpose of digital graphic: A digital graphic is an electronic image that can be used for a variety of different things, however the image does not always have to be used on electronic devices as it can be printed and used. Some examples of a digital graphic are magazines, posters, logos etc.. My poster will include images and pictures of popular films to create an eye catching poster that will gather the audience the client wants. The images wont be of just any movies but a wide range as this is an all inclusive film festival for people of all ages. The poster will be very high quality print using 600ppi. It will also have a .tiff image format because it is a high quality print, a big file size and has a lossless compression. With our digital graphic we must make it appealing to everybody because it is a family movie festival, so thus we need to combine the demographics of adults, teenagers and small children. This make it difficult as all of these demographics are very different and so we have to make it eye catching for younger audience but also very informative for an older audience, as well as not looking too childish as to attract teenagers. The graphic I’m going to create will be not only eye catching but also informative and show the true atmosphere that the festival will have, this means it will be simplistic yet interesting easy to read yet informative as I feel this will feel my client needs the best.
    [Show full text]
  • Vector Graphics Is the Use of Geometrical Primitives Such As Points, Lines, Curves, and Polygons to Represent Images in Computer Graphics
    Preparing Images for the Web Anne Nolan EWD Workshop Thursday January 19, 2006 Vector & Raster What is the difference? Which is best for Web graphics? How can you tell the difference? Vector or Bitmap Vector graphics is the use of geometrical primitives such as points, lines, curves, and polygons to represent images in computer graphics Bitmap or raster graphics is the representation of images as a collection of pixels or dots Vector Graphics Vector Graphics Creation and Editing Software Illustrator .ai Corel Draw .cdr Freehand .fh# CAD Files .dwg EPS Encapsulated Postscript .eps PDF .pdf Raster Graphics Raster Creation and Editing Software Photoshop .psd Fireworks .png ImageReady .psd Corel PhotoPaint Paintshop Pro .psp Common Raster Image File Extensions .gif, .jpg, .png, .bmp, .tif Characteristics Scaling: Raster graphics cannot be scaled to a higher resolution without loss of apparent quality Vector graphics easily scale to the quality of the device on which they are rendered without distortion Characteristics Visual Usage: Raster graphics are more practical than vector graphics for photographs and photo- realistic images Vector graphics are often more practical for typesetting or graphic design Characteristics Web Usage: Vector file formats (most) are NOT viewable in a browser without a plug-in. Example: the SVG file format created in Flash needs the Flash Player Raster graphics are easily used on the Web due to the pixel based display of computer monitors. Vector or Raster? Vector or Raster? Raster it is!
    [Show full text]
  • Raster Graphics: a Tutorial and Implementation Guide
    (Supersedes NISTIR 4567) Raster Graphics: A Tutorial and Implementation Guide Frankie E. Spielman Louis H. Sharpe, II U.S. DEPARTMENT OF COMMERCE Technology Administration National Institute of Standards and Technology Computer Systems Laboratory Gaithersburg, MD 20899 QC 100 NIST • U56 #5108 1993 (Supersedes NISTIR 4567) Raster Graphics: A Tutorial and Implementation Guide Frankie E. Spielman Louis H. Sharpe, II U.S. DEPARTMENT OF COMMERCE Technology Administration National Institute of Standards and Technology Computer Systems Laboratory Gaithersburg, MD 20899 January 1993 U.S. DEPARTMENT OF COMMERCE Barbara Hackman Franklin, Secretary TECHNOLOGY ADMINISTRATION Robert M. White, Under Secretary for Technology NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY John W. Lyons, Director . - ' .. :% ,; ^^''^;S' 'j! v'- v' '“"*' •''../ .ig;'-^^,- ' " -, /7'' A^vi' ' ‘''=' • ;•.. -1 \-'''-- : J \7A^rif^y“''f7£y ' - I .. 1 '.VI i . Preface This report examines the technical issues facing an implementor of the raster data interchange format defined in the Open Document Architecture (ODA) Raster Document Application Profile (DAP) . The ODA Raster DAP is also included as an appendix to military specification MIL-R-28002B . Information previously scattered throughout several standards is incorporated into this report for ease of reference. The ODA Raster DAP is analyzed with regard to both notation and intent. The motivation behind the development of the raster graphics file formats for large documents which are detailed in the ODA Raster DAP originated in a meeting between the Department of Defense (DoD) and industry experts in 1987. The Computer-aided Acquisition and Logistic Support (CALS) Office of DoD asked the large document raster industry to provide suggestions for a standard interchange file format and raster encoding scheme.
    [Show full text]
  • Forcepoint DLP Supported File Formats and Size Limits
    Forcepoint DLP Supported File Formats and Size Limits Supported File Formats and Size Limits | Forcepoint DLP | v8.8.1 This article provides a list of the file formats that can be analyzed by Forcepoint DLP, file formats from which content and meta data can be extracted, and the file size limits for network, endpoint, and discovery functions. See: ● Supported File Formats ● File Size Limits © 2021 Forcepoint LLC Supported File Formats Supported File Formats and Size Limits | Forcepoint DLP | v8.8.1 The following tables lists the file formats supported by Forcepoint DLP. File formats are in alphabetical order by format group. ● Archive For mats, page 3 ● Backup Formats, page 7 ● Business Intelligence (BI) and Analysis Formats, page 8 ● Computer-Aided Design Formats, page 9 ● Cryptography Formats, page 12 ● Database Formats, page 14 ● Desktop publishing formats, page 16 ● eBook/Audio book formats, page 17 ● Executable formats, page 18 ● Font formats, page 20 ● Graphics formats - general, page 21 ● Graphics formats - vector graphics, page 26 ● Library formats, page 29 ● Log formats, page 30 ● Mail formats, page 31 ● Multimedia formats, page 32 ● Object formats, page 37 ● Presentation formats, page 38 ● Project management formats, page 40 ● Spreadsheet formats, page 41 ● Text and markup formats, page 43 ● Word processing formats, page 45 ● Miscellaneous formats, page 53 Supported file formats are added and updated frequently. Key to support tables Symbol Description Y The format is supported N The format is not supported P Partial metadata
    [Show full text]
  • Digital Preservation Guidance Note: Graphics File Formats
    Digital Preservation Guidance Note: 4 Graphics File Formats Digital Preservation Guidance Note 4: Graphics file formats Document Control Author: Adrian Brown, Head of Digital Preservation Research Document Reference: DPGN-04 Issue: 2 Issue Date: August 2008 ©THE NATIONAL ARCHIVES 2008 Page 2 of 15 Digital Preservation Guidance Note 4: Graphics file formats Contents 1 INTRODUCTION .....................................................................................................................4 2 TYPES OF GRAPHICS FORMAT........................................................................................4 2.1 Raster Graphics ...............................................................................................................4 2.1.1 Colour Depth ............................................................................................................5 2.1.2 Colour Spaces and Palettes ..................................................................................5 2.1.3 Transparency............................................................................................................6 2.1.4 Interlacing..................................................................................................................6 2.1.5 Compression ............................................................................................................7 2.2 Vector Graphics ...............................................................................................................7 2.3 Metafiles............................................................................................................................7
    [Show full text]
  • Webp - Faster Web with Smaller Images
    WebP - Faster Web with smaller images Pascal Massimino Google Confidential and Proprietary WebP New image format - Why? ● Average page size: 350KB ● Images: ~65% of Internet traffic Current image formats ● JPEG: 80% of image bytes ● PNG: mainly for alpha, lossless not always wanted ● GIF: used for animations (avatars, smileys) WebP: more efficient unified solution + extra goodies Targets Web images, not at replacing photo formats. Google Confidential and Proprietary WebP ● Unified format ○ Supports both lossy and lossless compression, with transparency ○ all-in-one replacement for JPEG, PNG and GIF ● Target: ~30% smaller images ● low-overhead container (RIFF + chunks) Google Confidential and Proprietary WebP-lossy with alpha Appealing replacement for unneeded lossless use of PNG: sprites for games, logos, page decorations ● YUV: VP8 intra-frame ● Alpha channel: WebP lossless format ● Optional pre-filtering (~10% extra compression) ● Optional quantization --> near-lossless alpha ● Compression gain: 3x compared to lossless Google Confidential and Proprietary WebP - Lossless Techniques ■ More advanced spatial predictors ■ Local palette look up ■ Cross-color de-correlation ■ Separate entropy models for R, G, B, A channels ■ Image data and metadata both are Huffman-coded Still is a very simple format, fast to decode. Google Confidential and Proprietary WebP vs PNG source: published study on developers.google.com/speed/webp Average: 25% smaller size (corpus: 1000 PNG images crawled from the web, optimized with pngcrush) Google Confidential and Proprietary Speed number (takeaway) Encoding ● Lossy (VP8): 5x slower than JPEG ● Lossless: from 2x faster to 10x slower than libpng Decoding ● Lossy (VP8): 2x-3x slower than JPEG ● Lossless: ~1.5x faster than libpng Decoder's goodies: ● Incremental ● Per-row output (very low memory footprint) ● on-the-fly rescaling and cropping (e.g.
    [Show full text]
  • Web Graphics and File Formats
    Web Graphics and File Formats Chapter 8 Types of Graphics • Raster – Made up of pixels • Pixels are tiny squares of color arranged on a rectangular grid like tiles in a mosaic • Human eye reads pixels as a seamless image • Vector – Composed of simple lines defined by math equations – Logos, text banners, and 3D Web buttons are often vector graphics Graphic File Formats • GIF – Graphic Interchange Format • JPEG – Joint Photographic Experts Group • BMP – Bitmap • PNG – Portable Network Graphics GIF • File Extension: gif • Advantages: – Small file size downloads quickly – Good for line drawings and simple graphics – Only image that can be transparent or animated • Disadvantages – Only supports a maximum of 256 colors – Limited number of colors makes it not appropriate for photographs JPEG • File Extension: jpg or jpeg • Advantages: – Supports millions of colors – Color support makes it good for photos • Disadvantages – Files have a higher quality therefore they are larger in size and take longer to download BMP • File Extension: bmp • Advantages: – Supports millions of colors • Disadvantages – Very large files download slowly – Generally not used for web pages PNG • File Extension: png • Advantages: – Supports more colors than GIF but downloads quickly – Features better support of transparency than GIF • Disadvantages – Not supported by many browsers Interesting Format Info • GIF is pronounced with a hard “g” as in the word graphic • JPEG is pronounced “jay-peg” • Both formats are based on pixels • Most images on web are raster graphics (jpeg
    [Show full text]
  • Zajy\CZKOWSKI Grzegorz, JAROSZ Bartosz
    OVERVIEW OF IMAGE FORMATS SUITABLE FOR PRESENTATION OF ART ON THE WWW ZAJy\CZKOWSKI Grzegorz, JAROSZ Bartosz, WOJCIECHOWSKI Konrad, SMOtKA Bogdan, Silesian Technical University of Gliwice Department of Computer Science Akademicka 16, 44-101 Gliwice Email: bsmolka(a).peach.ia.oolsl. qliwice.pl NAtECKAAnna, MAtECKA Agnieszka SYNOWIEC Pawet, KROL Bogdan School of Arts Katowice An important aspect of image processing is the enormous amount of data which has to be handled when transmitting digital images. The efficient transmission of images is extremally important as the image data transfer takes up over 90 percent of the volume on the Internet. In this aspect computer data compression is a powerfull technology which is playing a vital role in the Information Age. The compression of information can be devided into lossles and lossy techniques. In some cases such as text or financial data transfer only the losless algoritms can be applied. However when transmitting or storing digital images or music data, the application of losssy techniques is aimost invisible to the user, but enables a drastic reduction of the data volume. In this article we present some of the compression techniques which can be used when transmitting or storing digital images. All the formats we were able to gather are accompanied by a short description and an Internet link, which can be used when detailed information is needed. Our intention is to find the optimal compression format for presenting artistic images over the Internet. The first step of our project is the cataloging of the existing formats and evaluating their efficiency when transmitting data containing artistic features.
    [Show full text]