Using CaptureScreen OriginalLocation isn't recorded properly

So I made a function to capture images to limit the time it takes to capture lots of images.

So I call the function

“CaptureImageScript”.CaptureImages (the folder of my folder,(200,200),(500,400),“BackgroundPatternFill” ,“Pulsing”, 4)

Parameter 2 top left coordinate and 3 bottom right coordinate for the capture rectangle.

Then in the function it captures like this.
CaptureScreen(Name: item 1 of params & “Result” & cnt, rectangle:((item 2 of params),(item 3 of params)), ImageInfo: CaptureInfo)

I just set the SearchType and Discrepency for Image Info.

When I use the Image Doctor the Original Location is set to 150, 100

Any thoughts on how to fix this?

Is it Info you are looking at in Image Doctor? That’s the Hot Spot, which by default is the center of the found image. (500-200)/2, (400/200)/2 seems right to me.

Well it happens when I perform a Search using the Image Doctor

To my understanding the Original Location should be the center of where the image was captured so the original location should be

500 - 200 = 300/2 = 150 so 200 + 150 = 350

400 - 200 = 200/2 = 100 so 200 + 100 = 300

So shouldn’t the original location be 350,300 which is the center of the capture rectangle.

You also need to specify the capture location in your image information property list.

Here is an example:

to CaptureImage name, rect
	put the folder of my folder & "Images/" into path
	put (CaptureLocation:item 1 of rect, SearchType:..., ) into info
	CaptureScreen(ImageName:path & name, rectangle:rect, ImageInfo:info)
	put imageSize(name)
	put imageInfo(name)
end captureimage

Thanks for the post – that appears to be a bug with the CaptureScreen command (that it doesn’t record the original location).

That has been corrected for the next release of Eggplant but in the meantime you can fix it in your script by adding CaptureLocation to the image info:


NOTE: Regardless of how you might see that reported by the image doctor, internally it needs to be recorded as the UPPER LEFT coordinate of the capture.