{"id":5799,"date":"2019-08-15T20:48:39","date_gmt":"2019-08-15T15:48:39","guid":{"rendered":"https:\/\/ahmadawais.com\/?p=5799"},"modified":"2019-08-15T21:27:56","modified_gmt":"2019-08-15T16:27:56","slug":"resize-optimize-images-javascript-node","status":"publish","type":"post","link":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/","title":{"rendered":"Resize &#038; Optimize Images With JavaScript in Node.js"},"content":{"rendered":"<p>Lately, I have been working with a couple of image-intensive projects with Node.js, Next.js, React.js, and really only with JavaScript. I used to use a package called <a href=\"https:\/\/www.npmjs.com\/package\/gm\">gm<\/a> to optimize and resize images but that came at a cost of installing a couple of other native packages like GraphicsMagick and ImageMagick for node.<\/p>\n<p>Naturally, that&#8217;s not a good thing for a project that&#8217;s being used by several developers on macOS, Windows, Linux, and on Raspberry Pi in the near future. So, in search of a better and JavaScript the only good solution I finally found a package called <a href=\"https:\/\/github.com\/oliver-moran\/jimp\">Jimp<\/a> \u2014 which has been pretty great to work with. Props to Oliver Moran.<\/p>\n<\/section>\n<div class=\"postcontents full dark\">\n<div class=\"wrapper\">\n<h2 id=\"%f0%9f%94%b0-resizing-optimizing-images-in-node-js\">\ud83d\udd30 Resizing &amp; Optimizing images in Node.js<a href=\"#%f0%9f%94%b0-resizing-optimizing-images-in-node-js\" class=\"heading-link\">#<\/a><\/h2>\n<\/div>\n<\/div>\n<section class=\"postcontents wrapper\">\n<p>Let&#8217;s get started with Jimp and resize a set of images while also optimizing them in sort of an automated way. So, this is what you need:<\/p>\n<ul>\n<li><code>images<\/code> an array of images paths.<\/li>\n<li><code>width<\/code> desired width number.<\/li>\n<li><code>height<\/code> automatically resize the height as per the width while observing the same aspect ratio so that we don&#8217;t have to guess.<\/li>\n<li><code>quality<\/code> the desired quality number like e.g., 90% would do.<\/li>\n<\/ul>\n<h3 id=\"%e2%9d%af-install-jimp\">\u276f Install Jimp<a href=\"#%e2%9d%af-install-jimp\" class=\"heading-link\">#<\/a><\/h3>\n<p>At this point, I assume that you have Node.js\/npm installed and you have already kickstarted a project using <code>npm init<\/code>. Am I right?!<\/p>\n<div class=\"wide\">\n<pre class=\"lang:javascript\">npm install jimp<\/pre>\n<\/div>\n<h3 id=\"%e2%9d%af-read-resize-optimize-and-write\">\u276f Read, Resize, Optimize, and Write<a href=\"#%e2%9d%af-read-resize-optimize-and-write\" class=\"heading-link\">#<\/a><\/h3>\n<p>Now that we have installed jimp, we need to use jimp to read an image path, resize it, optimize it, and finally write the new image to the same path.<\/p>\n<div class=\"wide\">\n<pre class=\"lang:javascript mark:15-18\">\/* RESIZE OPTIMIZE IMAGES *\/\r\nconst Jimp = require('jimp');\r\n\r\n\/**\r\n * Resize + optimize images.\r\n *\r\n * @param Array images An array of images paths.\r\n * @param Number width A number value of width e.g. 1920.\r\n * @param Number height Optional number value of height e.g. 1080.\r\n * @param Number quality Optional number value of quality of the image e.g. 90.\r\n *\/\r\nmodule.exports = async (images, width, height = Jimp.AUTO, quality) =&gt; {\r\n\tawait Promise.all(\r\n\t\timages.map(async imgPath =&gt; {\r\n\t\t\tconst image = await Jimp.read(imgPath);\r\n\t\t\tawait image.resize(width, height);\r\n\t\t\tawait image.quality(quality);\r\n\t\t\tawait image.writeAsync(imgPath);\r\n\t\t})\r\n\t);\r\n};<\/pre>\n<\/div>\n<h4 id=\"explanation\">Explanation<a href=\"#explanation\" class=\"heading-link\">#<\/a><\/h4>\n<div>\n<ul>\n<li><code>await Jimp.read(imgPath)<\/code> Reading the image.<\/li>\n<li><code>await image.resize(width, height)<\/code> Resize the image with the given width but I don&#8217;t use height so the default value of <code>Jimp.AUTO<\/code> would resize the height as per the given width but keeping the same aspect ratio. This keeps things easy, you don&#8217;t have to do the math.<\/li>\n<li><code>await image.quality(quality)<\/code> Set a certain quality like 90%.<\/li>\n<li><code>await image.writeAsync(imgPath)<\/code> Write the image without callback in an async way. Super important to not use the <code>.write<\/code> method with <code>async<\/code>\/<code>await<\/code>. I&#8217;ve been down that <a href=\"https:\/\/twitter.com\/MrAhmadAwais\/status\/1161740680563179520\">rabbit hole<\/a>.<\/li>\n<\/ul>\n<p>That&#8217;s pretty much about it. Go ahead and use this function.<\/p>\n<\/section>\n<div class=\"postcontents full dark\">\n<div class=\"wrapper\">\n<h2 id=\"%f0%9f%93%9f-node-js-module-resize-optimize-images\">\ud83d\udcdf Node.js Module: <a href=\"https:\/\/github.com\/ahmadawais\/resize-optimize-images\"><code>resize-optimize-images<\/code><\/a><a href=\"#%f0%9f%93%9f-node-js-module-resize-optimize-images\" class=\"heading-link\">#<\/a><\/h2>\n<\/div>\n<\/div>\n<section class=\"postcontents wrapper\">\n<p>That&#8217;s right. I have wrapped this in a nice little yet configurable node module called <a href=\"https:\/\/github.com\/ahmadawais\/resize-optimize-images\">resize-optimize-images<\/a> that you can install in your Node.js projects. This is how you go about it.<\/p>\n<h3 id=\"%e2%9d%af-install\">\u276f Install<a href=\"#%e2%9d%af-install\" class=\"heading-link\">#<\/a><\/h3>\n<div class=\"wide\">\n<pre class=\"lang:javascript\">npm install resize-optimize-images<\/pre>\n<\/div>\n<h3 id=\"%e2%9d%af-usage\">\u276f Usage<a href=\"#%e2%9d%af-usage\" class=\"heading-link\">#<\/a><\/h3>\n<div class=\"wide\">\n<pre class=\"lang:javascript\">const resizeOptimizeImages = require('resize-optimize-images');\r\n\r\n(async () =&gt; {\r\n\t\/\/ Set the options.\r\n\tconst options = {\r\n\t\timages: ['path\/to\/image.jpg', 'path\/to\/image.png'],\r\n\t\twidth: 1920,\r\n\t\tquality: 90\r\n\t};\r\n\t\r\n\t\/\/ Run the module.\r\n\tawait resizeOptimizeImages(options);\r\n})();<\/pre>\n<\/div>\n<p>Have fun hacking with JavaScript in Node.js. Use your code for good. Peace!<\/p>\n<p style=\"text-align: center;\">\n<div class=\"alert gray\">\n<p style=\"text-align: center;\">\ud83c\udf1f Don&#8217;t forget to star this repository <a href=\"https:\/\/github.com\/ahmadawais\/resize-optimize-images\">resize-optimize-images<\/a> \u2192<\/p>\n<p style=\"text-align: center;\"><\/div>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Learn how I resize and optimize images with JavaScript in Node.js. You can either do it yourself or install the resize-optimize-images node module and get it done. <\/p>\n","protected":false},"author":2,"featured_media":5821,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"webmentions_disabled_pings":false,"webmentions_disabled":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[181,215],"tags":[246,55,239],"class_list":["post-5799","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","category-web","tag-images","tag-javascript","tag-nodejs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Resize &amp; Optimize Images With JavaScript in Node.js<\/title>\n<meta name=\"description\" content=\"Learn how I resize and optimize images with JavaScript in Node.js. You can either do it yourself or install the resize-optimize-images node module and get it done.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Resize &amp; Optimize Images With JavaScript in Node.js\" \/>\n<meta property=\"og:description\" content=\"Learn how I resize and optimize images with JavaScript in Node.js. You can either do it yourself or install the resize-optimize-images node module and get it done.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/\" \/>\n<meta property=\"og:site_name\" content=\"Ahmad Awais\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/facebook.com\/AhmadAwais\" \/>\n<meta property=\"article:author\" content=\"https:\/\/facebook.com\/AhmadAwais\" \/>\n<meta property=\"article:published_time\" content=\"2019-08-15T15:48:39+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-15T16:27:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ahmadawais.com\/wp-content\/uploads\/2019\/08\/resize-images-nodejs.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1692\" \/>\n\t<meta property=\"og:image:height\" content=\"848\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ahmad Awais\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@MrAhmadAwais\" \/>\n<meta name=\"twitter:site\" content=\"@MrAhmadAwais\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ahmad Awais\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/\"},\"author\":{\"name\":\"Ahmad Awais\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#\\\/schema\\\/person\\\/1d1b9504182dca2315cf039fb4ebb85b\"},\"headline\":\"Resize &#038; Optimize Images With JavaScript in Node.js\",\"datePublished\":\"2019-08-15T15:48:39+00:00\",\"dateModified\":\"2019-08-15T16:27:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/\"},\"wordCount\":438,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#\\\/schema\\\/person\\\/1d1b9504182dca2315cf039fb4ebb85b\"},\"image\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/resize-images-nodejs.jpg\",\"keywords\":[\"Images\",\"JavaScript\",\"Nodejs\"],\"articleSection\":[\"JavaScript\",\"Web\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/\",\"url\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/\",\"name\":\"Resize & Optimize Images With JavaScript in Node.js\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/resize-images-nodejs.jpg\",\"datePublished\":\"2019-08-15T15:48:39+00:00\",\"dateModified\":\"2019-08-15T16:27:56+00:00\",\"description\":\"Learn how I resize and optimize images with JavaScript in Node.js. You can either do it yourself or install the resize-optimize-images node module and get it done.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/#primaryimage\",\"url\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/resize-images-nodejs.jpg\",\"contentUrl\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2019\\\/08\\\/resize-images-nodejs.jpg\",\"width\":1692,\"height\":848,\"caption\":\"Resize Images Nodejs\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/resize-optimize-images-javascript-node\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ahmadawais.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resize &#038; Optimize Images With JavaScript in Node.js\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#website\",\"url\":\"https:\\\/\\\/ahmadawais.com\\\/\",\"name\":\"Ahmad Awais\",\"description\":\"Founder &amp; CEO of CommandCode.ai f\\\/k\\\/a Langbase | Google Developers Advisory Board (gDAB) founding member\",\"publisher\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#\\\/schema\\\/person\\\/1d1b9504182dca2315cf039fb4ebb85b\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ahmadawais.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/#\\\/schema\\\/person\\\/1d1b9504182dca2315cf039fb4ebb85b\",\"name\":\"Ahmad Awais\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Ahmad-Awais-face.jpg\",\"url\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Ahmad-Awais-face.jpg\",\"contentUrl\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Ahmad-Awais-face.jpg\",\"width\":2299,\"height\":1705,\"caption\":\"Ahmad Awais\"},\"logo\":{\"@id\":\"https:\\\/\\\/ahmadawais.com\\\/wp-content\\\/uploads\\\/2020\\\/06\\\/Ahmad-Awais-face.jpg\"},\"description\":\"Founder & CEO of \u2318 Command Code coding agent with taste. Founded Langbase.com, AI cloud to build, deploy, and scale AI agents with tools & memory \u00b7 Creator of Command.new. \\\"Awais is an awesome example for developers\\\" \u2014 Satya Nadella, CEO of Microsoft. NASA Mars Ingenuity Helicopter mission code contributor 8th GitHub Stars Award recipient with 5x GitHub Stars Award (Listed as GitHub's #1 JavaScript trending developer). Google Developers Expert Web DevRel. Ex VP Eng (DevTools & DevRel) Rapid \u00b7 Google Developers Advisory Board (gDAB) founding member \u00b7 AI\\\/ML\\\/DevTools Angel Investor (Replit, Resend, Daytona, Gumroad and you?) \u276f AI\\\/ML Advisory Board San Francisco, DevNetwork. Award-winning Open Source Engineering leader authored hundreds of open-source dev-tools and software libraries used by millions of developers, including Shades of Purple code theme and corona-cli. Linux Foundation (Node.js Committee Lead), OpenAPI Business Governing Board. Taught 108K+ developers via NodeCLI.com and VSCode.pro course. 274 million views, blogging for 24 yrs. \u276f Read more about Ahmad Awais or come say hi on \ud835\udd4f @MrAhmadAwais.\",\"sameAs\":[\"https:\\\/\\\/AhmadAwais.com\\\/\",\"https:\\\/\\\/facebook.com\\\/AhmadAwais\",\"https:\\\/\\\/instagram.com\\\/MrAhmadAwais\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/MrAhmadAwais\\\/\",\"https:\\\/\\\/x.com\\\/MrAhmadAwais\",\"https:\\\/\\\/youtube.com\\\/AhmadAwais\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Resize & Optimize Images With JavaScript in Node.js","description":"Learn how I resize and optimize images with JavaScript in Node.js. You can either do it yourself or install the resize-optimize-images node module and get it done.","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:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/","og_locale":"en_US","og_type":"article","og_title":"Resize & Optimize Images With JavaScript in Node.js","og_description":"Learn how I resize and optimize images with JavaScript in Node.js. You can either do it yourself or install the resize-optimize-images node module and get it done.","og_url":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/","og_site_name":"Ahmad Awais","article_publisher":"https:\/\/facebook.com\/AhmadAwais","article_author":"https:\/\/facebook.com\/AhmadAwais","article_published_time":"2019-08-15T15:48:39+00:00","article_modified_time":"2019-08-15T16:27:56+00:00","og_image":[{"width":1692,"height":848,"url":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2019\/08\/resize-images-nodejs.jpg","type":"image\/jpeg"}],"author":"Ahmad Awais","twitter_card":"summary_large_image","twitter_creator":"@MrAhmadAwais","twitter_site":"@MrAhmadAwais","twitter_misc":{"Written by":"Ahmad Awais","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/#article","isPartOf":{"@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/"},"author":{"name":"Ahmad Awais","@id":"https:\/\/ahmadawais.com\/#\/schema\/person\/1d1b9504182dca2315cf039fb4ebb85b"},"headline":"Resize &#038; Optimize Images With JavaScript in Node.js","datePublished":"2019-08-15T15:48:39+00:00","dateModified":"2019-08-15T16:27:56+00:00","mainEntityOfPage":{"@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/"},"wordCount":438,"commentCount":0,"publisher":{"@id":"https:\/\/ahmadawais.com\/#\/schema\/person\/1d1b9504182dca2315cf039fb4ebb85b"},"image":{"@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/#primaryimage"},"thumbnailUrl":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2019\/08\/resize-images-nodejs.jpg","keywords":["Images","JavaScript","Nodejs"],"articleSection":["JavaScript","Web"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/","url":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/","name":"Resize & Optimize Images With JavaScript in Node.js","isPartOf":{"@id":"https:\/\/ahmadawais.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/#primaryimage"},"image":{"@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/#primaryimage"},"thumbnailUrl":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2019\/08\/resize-images-nodejs.jpg","datePublished":"2019-08-15T15:48:39+00:00","dateModified":"2019-08-15T16:27:56+00:00","description":"Learn how I resize and optimize images with JavaScript in Node.js. You can either do it yourself or install the resize-optimize-images node module and get it done.","breadcrumb":{"@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/#primaryimage","url":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2019\/08\/resize-images-nodejs.jpg","contentUrl":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2019\/08\/resize-images-nodejs.jpg","width":1692,"height":848,"caption":"Resize Images Nodejs"},{"@type":"BreadcrumbList","@id":"https:\/\/ahmadawais.com\/resize-optimize-images-javascript-node\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ahmadawais.com\/"},{"@type":"ListItem","position":2,"name":"Resize &#038; Optimize Images With JavaScript in Node.js"}]},{"@type":"WebSite","@id":"https:\/\/ahmadawais.com\/#website","url":"https:\/\/ahmadawais.com\/","name":"Ahmad Awais","description":"Founder &amp; CEO of CommandCode.ai f\/k\/a Langbase | Google Developers Advisory Board (gDAB) founding member","publisher":{"@id":"https:\/\/ahmadawais.com\/#\/schema\/person\/1d1b9504182dca2315cf039fb4ebb85b"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ahmadawais.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/ahmadawais.com\/#\/schema\/person\/1d1b9504182dca2315cf039fb4ebb85b","name":"Ahmad Awais","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2020\/06\/Ahmad-Awais-face.jpg","url":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2020\/06\/Ahmad-Awais-face.jpg","contentUrl":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2020\/06\/Ahmad-Awais-face.jpg","width":2299,"height":1705,"caption":"Ahmad Awais"},"logo":{"@id":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2020\/06\/Ahmad-Awais-face.jpg"},"description":"Founder & CEO of \u2318 Command Code coding agent with taste. Founded Langbase.com, AI cloud to build, deploy, and scale AI agents with tools & memory \u00b7 Creator of Command.new. \"Awais is an awesome example for developers\" \u2014 Satya Nadella, CEO of Microsoft. NASA Mars Ingenuity Helicopter mission code contributor 8th GitHub Stars Award recipient with 5x GitHub Stars Award (Listed as GitHub's #1 JavaScript trending developer). Google Developers Expert Web DevRel. Ex VP Eng (DevTools & DevRel) Rapid \u00b7 Google Developers Advisory Board (gDAB) founding member \u00b7 AI\/ML\/DevTools Angel Investor (Replit, Resend, Daytona, Gumroad and you?) \u276f AI\/ML Advisory Board San Francisco, DevNetwork. Award-winning Open Source Engineering leader authored hundreds of open-source dev-tools and software libraries used by millions of developers, including Shades of Purple code theme and corona-cli. Linux Foundation (Node.js Committee Lead), OpenAPI Business Governing Board. Taught 108K+ developers via NodeCLI.com and VSCode.pro course. 274 million views, blogging for 24 yrs. \u276f Read more about Ahmad Awais or come say hi on \ud835\udd4f @MrAhmadAwais.","sameAs":["https:\/\/AhmadAwais.com\/","https:\/\/facebook.com\/AhmadAwais","https:\/\/instagram.com\/MrAhmadAwais\/","https:\/\/www.linkedin.com\/in\/MrAhmadAwais\/","https:\/\/x.com\/MrAhmadAwais","https:\/\/youtube.com\/AhmadAwais"]}]}},"jetpack_featured_media_url":"https:\/\/ahmadawais.com\/wp-content\/uploads\/2019\/08\/resize-images-nodejs.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/posts\/5799","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/comments?post=5799"}],"version-history":[{"count":5,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/posts\/5799\/revisions"}],"predecessor-version":[{"id":5820,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/posts\/5799\/revisions\/5820"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/media\/5821"}],"wp:attachment":[{"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/media?parent=5799"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/categories?post=5799"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ahmadawais.com\/api\/wp\/v2\/tags?post=5799"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}