From the course: Scripting for Testers

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Comparing images

Comparing images

- [Instructor] In the last video, we created an image that showed a diff between two images. That's an interesting way to compare images. But now let's look at creating an image that contains both images. So we'll do that inside our compare images method here. So here we're saving the diff, but let's also save a comparison image. And we'll start by actually creating a blank image that's big enough to hold both images that we plan to put into it. And then we'll insert each image into that blank image. So let's first figure out the height that we want. So we'll get the max height of our two images, which is max, and then our img1 height and our img2 height. And then we'll create a new image, which we'll call combined. And we'll use the Image.new method to do that. We want it to be a red, green, blue image. And then we have to specify the width and the height of this image. So the width that it's going to have is just going to be img1.width + img2.width. So we're going to add the two…

Contents