how to highlight differences in almost identical images?

This is another part of a regression QA tool im building.

I need to be able to compare the data inside one image file to the data inside a previously stored image file and then detect any differences. If there are differences they need to somehow be flagged.

I don’t even know where to begin on this one. I am thinking something with photoshop perhaps and blending modes?

any help would be greatly appreciated.



tinkering with photoshop I can see that by using a difference blend mode everything that is the same between 2 images turns black.

could someone put in the right direction in figuring out how i can bring in 2 images, set the top image to have a blend mode of difference and then analyze the composition to see if it is 100% black or if it is less to export a still of the composition and add the file name to a spreadsheet.


You could combine your 2 images with something like this then save the result to file. I don’t think Photoshop is going to be a good tool to analyze the pixel data though.

property Default_Path : (path to desktop folder as Unicode text)

set File_A to choose file with prompt "Locate the image you want to copy a layer to." without invisibles
set File_B to choose file with prompt "Locate the image you want to copy a layer from." without invisibles

tell application "Adobe Photoshop CS2"
	open File_A
	set Doc_A to the current document
	open File_B
	set Doc_B to the current document
	tell Doc_B
		duplicate layer 1 to beginning of Doc_A
	end tell
	close Doc_B without saving
	tell Doc_A
		set blend mode of layer 1 to difference
		set File_Path to Default_Path & "Some Name" & ".tif"
		save Doc_A in file File_Path as TIFF with options ¬
			{class:TIFF save options, image compression:LZW, byte order:Mac OS, save alpha channels:false, save spot colors:false, embed color profile:true, save layers:false, transparency:false}
	end tell
	close current document without saving
end tell