{"id":3972,"date":"2025-08-15T18:09:00","date_gmt":"2025-08-16T00:09:00","guid":{"rendered":"https:\/\/elbsolutions.com\/projects\/?p=3972"},"modified":"2025-09-23T18:23:07","modified_gmt":"2025-09-24T00:23:07","slug":"replace-all-photos-that-are-a-placeholder","status":"publish","type":"post","link":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/","title":{"rendered":"Replace all photos that are a placeholder"},"content":{"rendered":"<p>When the two systems sync, there MUST be an image or the program crashes so we put a nice placeholder image with the customer&#8217;s logo. Its a grey slab with the logo. With takeovers and mergers and time for a face lift, companies update their logo! Well now we are in a pickle, because <!--more-->the images is copied all over. Well, we made a quick macro, looked for the average greyscale of the image, hashed it and &#8230; VERY CONSISTENT results. No need to make a copy routine &#8211; just dump all these metrics to excel and add a column at the end with an xcopy command with the new one and your done! Simple.<\/p>\n<p>We had to change all the placeholder images in the countertop industry. Two different systems are we synchronized &#8211; yes we build this software. It syncs between two different popular granite countertop managent software AND a very popular layout software. This layout software allows you to place REAL countertop hi-res images into templated kitchens and bathrooms in essence matching up veins of the rock without making any real cuts; no chances for mistakes because you haven&#8217;t done anything real. The management software allows inventory, process and other details about every slab at every stage of the slab&#8217;s life cycle. We also set these software&#8217;s up and maintain them.<\/p>\n<p>Within about 1\/2 hour the slabs are all renamed. You can re-run the software as a double check. This macro software is NOT fully built out with a nice interface which keeps the cost down. Scripts\/Macros like these need to be run about every 3 years for every company &#8211; proving that you do NOT need to build fully polished tool.<\/p>\n<blockquote><p>Lets keep the cost and overhead down for all parties &#8211; a win-win.<\/p><\/blockquote>\n<p>On a nerdy note, since this is why I made most of these blog posts, do NOT use System.Drawing.Image &#8211; it crashes after 90,000 images repeatedly. You can set it to null, clear all sorts of this or that &#8211; then if you look up others who have these issues, sure enough DO NOT USE IT. System.Drawing.Bitmap worked well instead.<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">&lt;\/pre&gt;\r\n        public ImageAnalysisResult IsMostlyGrayscale(string imagePath)\r\n        {\r\n            using var bitmap = new Bitmap(imagePath);\r\n\r\n            int width = bitmap.Width;\r\n            int height = bitmap.Height;\r\n            int grayscalePixels = 0;\r\n            int totalPixels = width * height;\r\n\r\n            for (int y = 0; y &lt; height; y++)\r\n            {\r\n                for (int x = 0; x &lt; width; x++)\r\n                {\r\n                    Color c = bitmap.GetPixel(x, y);\r\n                    int max = Math.Max(c.R, Math.Max(c.G, c.B));\r\n                    int min = Math.Min(c.R, Math.Min(c.G, c.B));\r\n                    int diff = max - min;\r\n\r\n                    if (diff &lt;= PixelThreshold)\r\n                    {\r\n                        grayscalePixels++;\r\n                    }\r\n                }\r\n            }\r\n\r\n            double ratio = (double)grayscalePixels \/ totalPixels;\r\n            return new ImageAnalysisResult\r\n            {\r\n                grayscaleValue = ratio,\r\n                IsMostlyGrayscale = ratio &gt;= GrayscaleRatioThreshold,\r\n                Width = width,\r\n                Height = height\r\n            };\r\n        }\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When the two systems sync, there MUST be an image or the program crashes so we put a nice placeholder image with the customer&#8217;s logo. Its a grey slab with the logo. With takeovers and mergers and time for a face lift, companies update their logo! Well now we are in a pickle, because<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,12],"tags":[53,54],"class_list":["post-3972","post","type-post","status-publish","format-standard","hentry","category-general","category-scripting","tag-c","tag-images"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.7 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Replace all photos that are a placeholder - ELB Solutions.com Inc.<\/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:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Replace all photos that are a placeholder - ELB Solutions.com Inc.\" \/>\n<meta property=\"og:description\" content=\"When the two systems sync, there MUST be an image or the program crashes so we put a nice placeholder image with the customer&#8217;s logo. Its a grey slab with the logo. With takeovers and mergers and time for a face lift, companies update their logo! Well now we are in a pickle, because\" \/>\n<meta property=\"og:url\" content=\"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/\" \/>\n<meta property=\"og:site_name\" content=\"ELB Solutions.com Inc.\" \/>\n<meta property=\"article:published_time\" content=\"2025-08-16T00:09:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-09-24T00:23:07+00:00\" \/>\n<meta name=\"author\" content=\"Etienne Bley\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Etienne Bley\" \/>\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:\\\/\\\/elbsolutions.com\\\/projects\\\/replace-all-photos-that-are-a-placeholder\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/replace-all-photos-that-are-a-placeholder\\\/\"},\"author\":{\"name\":\"Etienne Bley\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\"},\"headline\":\"Replace all photos that are a placeholder\",\"datePublished\":\"2025-08-16T00:09:00+00:00\",\"dateModified\":\"2025-09-24T00:23:07+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/replace-all-photos-that-are-a-placeholder\\\/\"},\"wordCount\":473,\"keywords\":[\"c#\",\"images\"],\"articleSection\":[\"General\",\"Scripting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/replace-all-photos-that-are-a-placeholder\\\/\",\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/replace-all-photos-that-are-a-placeholder\\\/\",\"name\":\"Replace all photos that are a placeholder - ELB Solutions.com Inc.\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#website\"},\"datePublished\":\"2025-08-16T00:09:00+00:00\",\"dateModified\":\"2025-09-24T00:23:07+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/replace-all-photos-that-are-a-placeholder\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/replace-all-photos-that-are-a-placeholder\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/replace-all-photos-that-are-a-placeholder\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Replace all photos that are a placeholder\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#website\",\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/\",\"name\":\"ELB Solutions.com Inc.\",\"description\":\"Bringing all your IT Pieces together\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/#\\\/schema\\\/person\\\/51e717c68f4f5917c63baf88f0896c39\",\"name\":\"Etienne Bley\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g\",\"caption\":\"Etienne Bley\"},\"url\":\"https:\\\/\\\/elbsolutions.com\\\/projects\\\/author\\\/etienne-bley\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Replace all photos that are a placeholder - ELB Solutions.com Inc.","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:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/","og_locale":"en_US","og_type":"article","og_title":"Replace all photos that are a placeholder - ELB Solutions.com Inc.","og_description":"When the two systems sync, there MUST be an image or the program crashes so we put a nice placeholder image with the customer&#8217;s logo. Its a grey slab with the logo. With takeovers and mergers and time for a face lift, companies update their logo! Well now we are in a pickle, because","og_url":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/","og_site_name":"ELB Solutions.com Inc.","article_published_time":"2025-08-16T00:09:00+00:00","article_modified_time":"2025-09-24T00:23:07+00:00","author":"Etienne Bley","twitter_misc":{"Written by":"Etienne Bley","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/#article","isPartOf":{"@id":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/"},"author":{"name":"Etienne Bley","@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39"},"headline":"Replace all photos that are a placeholder","datePublished":"2025-08-16T00:09:00+00:00","dateModified":"2025-09-24T00:23:07+00:00","mainEntityOfPage":{"@id":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/"},"wordCount":473,"keywords":["c#","images"],"articleSection":["General","Scripting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/","url":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/","name":"Replace all photos that are a placeholder - ELB Solutions.com Inc.","isPartOf":{"@id":"https:\/\/elbsolutions.com\/projects\/#website"},"datePublished":"2025-08-16T00:09:00+00:00","dateModified":"2025-09-24T00:23:07+00:00","author":{"@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39"},"breadcrumb":{"@id":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/elbsolutions.com\/projects\/replace-all-photos-that-are-a-placeholder\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/elbsolutions.com\/projects\/"},{"@type":"ListItem","position":2,"name":"Replace all photos that are a placeholder"}]},{"@type":"WebSite","@id":"https:\/\/elbsolutions.com\/projects\/#website","url":"https:\/\/elbsolutions.com\/projects\/","name":"ELB Solutions.com Inc.","description":"Bringing all your IT Pieces together","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/elbsolutions.com\/projects\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/elbsolutions.com\/projects\/#\/schema\/person\/51e717c68f4f5917c63baf88f0896c39","name":"Etienne Bley","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f8971dfb65b25b768415568f83247df4057f15d037137e386928a804e2c997b9?s=96&d=mm&r=g","caption":"Etienne Bley"},"url":"https:\/\/elbsolutions.com\/projects\/author\/etienne-bley\/"}]}},"_links":{"self":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/3972","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/comments?post=3972"}],"version-history":[{"count":8,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/3972\/revisions"}],"predecessor-version":[{"id":3980,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/posts\/3972\/revisions\/3980"}],"wp:attachment":[{"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/media?parent=3972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/categories?post=3972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elbsolutions.com\/projects\/wp-json\/wp\/v2\/tags?post=3972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}