{"id":32628,"date":"2020-06-22T17:16:00","date_gmt":"2020-06-22T17:16:00","guid":{"rendered":"https:\/\/foojay.io\/?p=32628"},"modified":"2021-08-23T12:52:36","modified_gmt":"2021-08-23T12:52:36","slug":"how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage","status":"publish","type":"post","link":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/","title":{"rendered":"How does Java handle different Images and ColorSpaces \u2013 Part 3"},"content":{"rendered":"\n<p>BufferedImage is one of the most useful Java abstractions. It hides all the complexity of different types of images whilst allowing access to the underlying data. Under the hood, a BufferedImage can be many types of image. This is the list of types visible in an IDE.<\/p>\n\n\n<div class=\"wp-block-image is-style-default\"><figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/blog.idrsolutions.com\/wp-content\/uploads\/2020\/01\/Screenshot-2020-01-20-at-15.22.53-284x300.png\" alt=\"BufferedImage types\" class=\"wp-image-27242\"\/><\/figure><\/div>\n\n\n<p>The differences between the types of BufferedImage are:-<\/p>\n\n\n<ol class=\"wp-block-list\"><li>Range of Colours (Binary will give back and white only, RGB will provide 24-bit color)<\/li><li>Opacity (only available in ARGB \u2013 the A is an 8 bit Alpha channel).<\/li><li>Amount of memory used (ARGB uses the most as 4 bytes per pixel).<\/li><li>Size of the saved file.<\/li><\/ol>\n\n\n<p>A BufferedImage generally uses the RGB, Gray or Binary Color Spaces. Data can be in other formats, and the raw raster data can be loaded and accessed for CMYK and YCCK, but the Colors will not display correctly. BufferedImage provides lots of methods to access the raw image data, including the Raster, pixel and ColorModel used.<\/p>\n\n\n<p>All BufferedImages work the same, so the same code can be used to manipulate a BufferedImage. A Graphics2D drawing surface can be obtained directly from an instance of BuggeredImage with&nbsp;<strong>getGraphics()<\/strong>&nbsp;and used to draw shapes, text and other images over the original image. All are converted to the Image type used. So a Binary Image will only show black and white and any colors used will be converted.<\/p>\n\n\n<p>BufferedImages can be converted into other supported ColorSpaces types by using a ColorConvertOp. Java can be used for Image processing either via manipulating the BufferedImage directly or the Graphics2D object.<\/p>\n\n\n<p>So BufferedImage offers a really flexible abstraction which makes it very easy to make use of images in Java. Java developers no longer need to worry about image types and formats.<\/p>\n\n\n<p>Java includes support to load and save images in various formats using ImageIO, and other libraries such as Apache Imaging and our JDeli library also offer this feature.<\/p>\n\n\n<p>Next time we will talk more about ImageIO and other Image libraries.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>BufferedImage is one of the most useful Java abstractions. It hides all the complexity of different types of images whilst allowing access to the underlying data. Under the hood, a BufferedImage can be many types of image.<\/p>\n<p>Java includes support to load and save images in various formats using ImageIO, and other libraries such as Apache Imaging and our JDeli library also offer this feature.<\/p>\n<p>Next time we will talk more about ImageIO and other Image libraries.<\/p>\n","protected":false},"author":40,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[33,35],"class_list":["post-32628","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java","tag-openjdk"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>foojay \u2013 a place for friends of OpenJDK<\/title>\n<meta name=\"description\" content=\"foojay is the place for all OpenJDK Update Release Information. Learn More.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"foojay \u2013 a place for friends of OpenJDK\" \/>\n<meta property=\"og:description\" content=\"foojay is the place for all OpenJDK Update Release Information. Learn More.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/\" \/>\n<meta property=\"og:site_name\" content=\"foojay\" \/>\n<meta property=\"article:published_time\" content=\"2020-06-22T17:16:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-23T12:52:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/blog.idrsolutions.com\/wp-content\/uploads\/2020\/01\/Screenshot-2020-01-20-at-15.22.53-284x300.png\" \/>\n<meta name=\"author\" content=\"Mark Stephens\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mark Stephens\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/\"},\"author\":{\"name\":\"Mark Stephens\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/person\\\/750f1f5bc582e0c9728bf8f28e9461b7\"},\"headline\":\"How does Java handle different Images and ColorSpaces \u2013 Part 3\",\"datePublished\":\"2020-06-22T17:16:00+00:00\",\"dateModified\":\"2021-08-23T12:52:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/\"},\"wordCount\":339,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.idrsolutions.com\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/Screenshot-2020-01-20-at-15.22.53-284x300.png\",\"keywords\":[\"Java\",\"OpenJDK\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/\",\"url\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/\",\"name\":\"foojay \u2013 a place for friends of OpenJDK\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/blog.idrsolutions.com\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/Screenshot-2020-01-20-at-15.22.53-284x300.png\",\"datePublished\":\"2020-06-22T17:16:00+00:00\",\"dateModified\":\"2021-08-23T12:52:36+00:00\",\"description\":\"foojay is the place for all OpenJDK Update Release Information. Learn More.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/#primaryimage\",\"url\":\"https:\\\/\\\/blog.idrsolutions.com\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/Screenshot-2020-01-20-at-15.22.53-284x300.png\",\"contentUrl\":\"https:\\\/\\\/blog.idrsolutions.com\\\/wp-content\\\/uploads\\\/2020\\\/01\\\/Screenshot-2020-01-20-at-15.22.53-284x300.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/foojay.io\\\/today\\\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/foojay.io\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How does Java handle different Images and ColorSpaces \u2013 Part 3\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#website\",\"url\":\"https:\\\/\\\/foojay.io\\\/\",\"name\":\"foojay\",\"description\":\"a place for friends of OpenJDK\",\"publisher\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/foojay.io\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#organization\",\"name\":\"foojay\",\"url\":\"https:\\\/\\\/foojay.io\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/cropped-Favicon.png\",\"contentUrl\":\"https:\\\/\\\/foojay.io\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/cropped-Favicon.png\",\"width\":512,\"height\":512,\"caption\":\"foojay\"},\"image\":{\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/foojay2020\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/foojay.io\\\/#\\\/schema\\\/person\\\/750f1f5bc582e0c9728bf8f28e9461b7\",\"name\":\"Mark Stephens\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9ac75725e39c6001c43782366fe8c4a255662ed2db3a1582012d9f23ec1f60e6?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9ac75725e39c6001c43782366fe8c4a255662ed2db3a1582012d9f23ec1f60e6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9ac75725e39c6001c43782366fe8c4a255662ed2db3a1582012d9f23ec1f60e6?s=96&d=mm&r=g\",\"caption\":\"Mark Stephens\"},\"description\":\"Entrepreneur and Java software developer, founder and CEO of IDRsolutions\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/mnstephens\\\/\",\"https:\\\/\\\/x.com\\\/markee174\"],\"url\":\"https:\\\/\\\/foojay.io\\\/today\\\/author\\\/mark-stephens\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"foojay \u2013 a place for friends of OpenJDK","description":"foojay is the place for all OpenJDK Update Release Information. Learn More.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/","og_locale":"en_US","og_type":"article","og_title":"foojay \u2013 a place for friends of OpenJDK","og_description":"foojay is the place for all OpenJDK Update Release Information. Learn More.","og_url":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/","og_site_name":"foojay","article_published_time":"2020-06-22T17:16:00+00:00","article_modified_time":"2021-08-23T12:52:36+00:00","og_image":[{"url":"https:\/\/blog.idrsolutions.com\/wp-content\/uploads\/2020\/01\/Screenshot-2020-01-20-at-15.22.53-284x300.png","type":"","width":"","height":""}],"author":"Mark Stephens","twitter_misc":{"Written by":"Mark Stephens","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/#article","isPartOf":{"@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/"},"author":{"name":"Mark Stephens","@id":"https:\/\/foojay.io\/#\/schema\/person\/750f1f5bc582e0c9728bf8f28e9461b7"},"headline":"How does Java handle different Images and ColorSpaces \u2013 Part 3","datePublished":"2020-06-22T17:16:00+00:00","dateModified":"2021-08-23T12:52:36+00:00","mainEntityOfPage":{"@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/"},"wordCount":339,"commentCount":0,"publisher":{"@id":"https:\/\/foojay.io\/#organization"},"image":{"@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.idrsolutions.com\/wp-content\/uploads\/2020\/01\/Screenshot-2020-01-20-at-15.22.53-284x300.png","keywords":["Java","OpenJDK"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/","url":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/","name":"foojay \u2013 a place for friends of OpenJDK","isPartOf":{"@id":"https:\/\/foojay.io\/#website"},"primaryImageOfPage":{"@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/#primaryimage"},"image":{"@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/#primaryimage"},"thumbnailUrl":"https:\/\/blog.idrsolutions.com\/wp-content\/uploads\/2020\/01\/Screenshot-2020-01-20-at-15.22.53-284x300.png","datePublished":"2020-06-22T17:16:00+00:00","dateModified":"2021-08-23T12:52:36+00:00","description":"foojay is the place for all OpenJDK Update Release Information. Learn More.","breadcrumb":{"@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/#primaryimage","url":"https:\/\/blog.idrsolutions.com\/wp-content\/uploads\/2020\/01\/Screenshot-2020-01-20-at-15.22.53-284x300.png","contentUrl":"https:\/\/blog.idrsolutions.com\/wp-content\/uploads\/2020\/01\/Screenshot-2020-01-20-at-15.22.53-284x300.png"},{"@type":"BreadcrumbList","@id":"https:\/\/foojay.io\/today\/how-does-java-handle-different-images-and-colorspaces-part-3-introducing-the-bufferedimage\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/foojay.io\/"},{"@type":"ListItem","position":2,"name":"How does Java handle different Images and ColorSpaces \u2013 Part 3"}]},{"@type":"WebSite","@id":"https:\/\/foojay.io\/#website","url":"https:\/\/foojay.io\/","name":"foojay","description":"a place for friends of OpenJDK","publisher":{"@id":"https:\/\/foojay.io\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/foojay.io\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/foojay.io\/#organization","name":"foojay","url":"https:\/\/foojay.io\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/foojay.io\/#\/schema\/logo\/image\/","url":"https:\/\/foojay.io\/wp-content\/uploads\/2020\/04\/cropped-Favicon.png","contentUrl":"https:\/\/foojay.io\/wp-content\/uploads\/2020\/04\/cropped-Favicon.png","width":512,"height":512,"caption":"foojay"},"image":{"@id":"https:\/\/foojay.io\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/foojay2020"]},{"@type":"Person","@id":"https:\/\/foojay.io\/#\/schema\/person\/750f1f5bc582e0c9728bf8f28e9461b7","name":"Mark Stephens","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9ac75725e39c6001c43782366fe8c4a255662ed2db3a1582012d9f23ec1f60e6?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9ac75725e39c6001c43782366fe8c4a255662ed2db3a1582012d9f23ec1f60e6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9ac75725e39c6001c43782366fe8c4a255662ed2db3a1582012d9f23ec1f60e6?s=96&d=mm&r=g","caption":"Mark Stephens"},"description":"Entrepreneur and Java software developer, founder and CEO of IDRsolutions","sameAs":["https:\/\/www.linkedin.com\/in\/mnstephens\/","https:\/\/x.com\/markee174"],"url":"https:\/\/foojay.io\/today\/author\/mark-stephens\/"}]}},"_links":{"self":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts\/32628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/users\/40"}],"replies":[{"embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/comments?post=32628"}],"version-history":[{"count":0,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/posts\/32628\/revisions"}],"wp:attachment":[{"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/media?parent=32628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/categories?post=32628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/foojay.io\/wp-json\/wp\/v2\/tags?post=32628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}