{"id":60,"date":"2008-11-25T19:43:21","date_gmt":"2008-11-25T23:43:21","guid":{"rendered":"http:\/\/stoney.sb.org\/wordpress\/?p=60"},"modified":"2009-06-03T18:40:58","modified_gmt":"2009-06-03T23:40:58","slug":"pixel-perfect-graphics-revisited","status":"publish","type":"post","link":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/","title":{"rendered":"Pixel-perfect Graphics, Revisited"},"content":{"rendered":"<p><a href=\"http:\/\/www.wolfram.com\/products\/mathematica\/index.html\">Mathematica 7<\/a> introduces a new <a href=\"http:\/\/reference.wolfram.com\/mathematica\/ref\/Image.html?q=Image&#038;lang=en\">Image<\/a> function that eliminates all the hassle <a href=\"http:\/\/stoney.sb.org\/wordpress\/?p=50\">previously necessary<\/a> to create and export pixel-perfect raster images.<\/p>\n<p><!--more--><\/p>\n<p>Instead of using <a href=\"http:\/\/reference.wolfram.com\/mathematica\/ref\/ArrayPlot.html?q=ArrayPlot&#038;lang=en\">ArrayPlot<\/a> to generate the image, I can now do this:<\/p>\n<p><pre>\r\nmyImage = Image[imageData, ColorSpace->RGBColor]\r\n<\/pre>\n<p><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/stoney.sb.org\/wordpress\/wp-content\/myimage.png?resize=256%2C128\" alt=\"myImage.png\" border=\"0\" width=\"256\" height=\"128\" \/>\n<\/p>\n<p>I still need to specify <a href=\"http:\/\/reference.wolfram.com\/mathematica\/ref\/RGBColor.html\">RGBColor<\/a> to interpret the alpha channel correctly, but the option to Image is named <a href=\"http:\/\/reference.wolfram.com\/mathematica\/ref\/ColorSpace.html?q=ColorSpace&#038;lang=en\">ColorSpace<\/a>, instead of the <a href=\"\">ColorFunction<\/a> used by ArrayPlot.<\/p>\n<p>Exporting works the same way as before:<\/p>\n<pre>\r\nExport[\"~\/Desktop\/myImage.png\", myImage]\r\n<\/pre>\n<\/p>\n<p>Except that now I can directly export a png with alpha. Much simpler overall in the new Mathematica.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mathematica 7 introduces a new Image function that eliminates all the hassle previously necessary to create and export pixel-perfect raster images.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[17,13,20,14],"tags":[],"jetpack_publicize_connections":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Pixel-perfect Graphics, Revisited - Stoney&#039;s Zone<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Pixel-perfect Graphics, Revisited - Stoney&#039;s Zone\" \/>\n<meta property=\"og:description\" content=\"Mathematica 7 introduces a new Image function that eliminates all the hassle previously necessary to create and export pixel-perfect raster images.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/\" \/>\n<meta property=\"og:site_name\" content=\"Stoney&#039;s Zone\" \/>\n<meta property=\"article:published_time\" content=\"2008-11-25T23:43:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2009-06-03T23:40:58+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/stoney.sb.org\/wordpress\/wp-content\/myimage.png\" \/>\n<meta name=\"author\" content=\"stoney\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"stoney\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/\",\"url\":\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/\",\"name\":\"Pixel-perfect Graphics, Revisited - Stoney's Zone\",\"isPartOf\":{\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/stoney.sb.org\/wordpress\/wp-content\/myimage.png\",\"datePublished\":\"2008-11-25T23:43:21+00:00\",\"dateModified\":\"2009-06-03T23:40:58+00:00\",\"author\":{\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/#\/schema\/person\/d587bd16a4b79558c4f6e01c078fbdb1\"},\"breadcrumb\":{\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#primaryimage\",\"url\":\"http:\/\/stoney.sb.org\/wordpress\/wp-content\/myimage.png\",\"contentUrl\":\"http:\/\/stoney.sb.org\/wordpress\/wp-content\/myimage.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/stoney.sb.org\/wordpress\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Pixel-perfect Graphics, Revisited\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/#website\",\"url\":\"https:\/\/stoney.sb.org\/wordpress\/\",\"name\":\"Stoney's Zone\",\"description\":\"Thoughts about stuff\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/stoney.sb.org\/wordpress\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/#\/schema\/person\/d587bd16a4b79558c4f6e01c078fbdb1\",\"name\":\"stoney\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/stoney.sb.org\/wordpress\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/47ff741e5568d1283ae1d29cfa4248fa?s=96&d=mm&r=pg\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/47ff741e5568d1283ae1d29cfa4248fa?s=96&d=mm&r=pg\",\"caption\":\"stoney\"},\"sameAs\":[\"http:\/\/\"],\"url\":\"https:\/\/stoney.sb.org\/wordpress\/author\/stoney\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Pixel-perfect Graphics, Revisited - Stoney's Zone","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:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/","og_locale":"en_US","og_type":"article","og_title":"Pixel-perfect Graphics, Revisited - Stoney's Zone","og_description":"Mathematica 7 introduces a new Image function that eliminates all the hassle previously necessary to create and export pixel-perfect raster images.","og_url":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/","og_site_name":"Stoney's Zone","article_published_time":"2008-11-25T23:43:21+00:00","article_modified_time":"2009-06-03T23:40:58+00:00","og_image":[{"url":"http:\/\/stoney.sb.org\/wordpress\/wp-content\/myimage.png","type":"","width":"","height":""}],"author":"stoney","twitter_card":"summary_large_image","twitter_misc":{"Written by":"stoney"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/","url":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/","name":"Pixel-perfect Graphics, Revisited - Stoney's Zone","isPartOf":{"@id":"https:\/\/stoney.sb.org\/wordpress\/#website"},"primaryImageOfPage":{"@id":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#primaryimage"},"image":{"@id":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#primaryimage"},"thumbnailUrl":"http:\/\/stoney.sb.org\/wordpress\/wp-content\/myimage.png","datePublished":"2008-11-25T23:43:21+00:00","dateModified":"2009-06-03T23:40:58+00:00","author":{"@id":"https:\/\/stoney.sb.org\/wordpress\/#\/schema\/person\/d587bd16a4b79558c4f6e01c078fbdb1"},"breadcrumb":{"@id":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#primaryimage","url":"http:\/\/stoney.sb.org\/wordpress\/wp-content\/myimage.png","contentUrl":"http:\/\/stoney.sb.org\/wordpress\/wp-content\/myimage.png"},{"@type":"BreadcrumbList","@id":"https:\/\/stoney.sb.org\/wordpress\/pixel-perfect-graphics-revisited\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/stoney.sb.org\/wordpress\/"},{"@type":"ListItem","position":2,"name":"Pixel-perfect Graphics, Revisited"}]},{"@type":"WebSite","@id":"https:\/\/stoney.sb.org\/wordpress\/#website","url":"https:\/\/stoney.sb.org\/wordpress\/","name":"Stoney's Zone","description":"Thoughts about stuff","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/stoney.sb.org\/wordpress\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/stoney.sb.org\/wordpress\/#\/schema\/person\/d587bd16a4b79558c4f6e01c078fbdb1","name":"stoney","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/stoney.sb.org\/wordpress\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/47ff741e5568d1283ae1d29cfa4248fa?s=96&d=mm&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/47ff741e5568d1283ae1d29cfa4248fa?s=96&d=mm&r=pg","caption":"stoney"},"sameAs":["http:\/\/"],"url":"https:\/\/stoney.sb.org\/wordpress\/author\/stoney\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p76dm1-Y","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/posts\/60"}],"collection":[{"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/comments?post=60"}],"version-history":[{"count":10,"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/posts\/60\/revisions"}],"predecessor-version":[{"id":107,"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/posts\/60\/revisions\/107"}],"wp:attachment":[{"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/media?parent=60"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/categories?post=60"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/stoney.sb.org\/wordpress\/wp-json\/wp\/v2\/tags?post=60"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}