@snaders in DrawBot you don’t really resize an image, you change the scale at which it is drawn. (same logic as in Draw a letter within a viewbox) imgPath = 'https://i.ytimg.com/vi/oHg5SJYRHA0/hqdefault.jpg' # get image width & height imgWidth, imgHeight = imageSize(imgPath) # define box width & height boxWidth, boxHeight = 640, 640 # calculate scaling factors factorHeight = boxHeight / imgHeight factorWidth = boxWidth / imgWidth # draw scaled image with savedState(): scale(factorWidth, factorHeight) image(imgPath, (0, 0)) # draw box fill(None) stroke(1, 0, 0) strokeWidth(5) rect(0, 0, boxWidth, boxHeight)