1

I am editing the image , by changing Brightness , Contrast , Saturation .

I wanted to calculate the the time it takes to apply these changes on Preview of image . I mean , when I change Brightness from 0 to 10 (Using the automation script): So Brightness in the original image must increases.

So I need to calculate the time, it takes to change Original image preview to the Changed image Preview .

One way I know to do this is :

  1. We need to take the screen shot of the original image Preview
  2. Make change in brightness and start timer
  3. Take screenshot Preview and Continuously Compare with the original image till we find the difference .
  4. Stop the timer .

So the Time taken will be difference between the start time and Stop time . But here the problem is we will not see the accuracy , as there is sometime between one screenshot to another due to compare of original and Changed Preview image .

Can someone help me over here to find the accuracy .

Thanks!

Miki
  • 40,887
  • 13
  • 123
  • 202
Sreevathsabr
  • 649
  • 7
  • 23
  • how are you making these changes? I'm assuming human UI interactions… given what you've said I'd go with a high speed video camera as this would allow for things to be better quantified – Sam Mason Jan 18 '19 at 14:28
  • @SamMason Sorry ! I m using a script to do the change in the Brightness ... – Sreevathsabr Jan 18 '19 at 14:29
  • and why is it important to see the preview change via a series of screenshots? (this seems like a **very** inefficient way to go about getting at anything that doesn't involve a user) – Sam Mason Jan 18 '19 at 14:40
  • @SamMason the reason I want to do this is to check the performance .. Sometimes when image is of High quality it is taken a while to apply the change . So I want to check in preview . I don't have the code of the application which is making these changes on image . So only way to do is through preview – Sreevathsabr Jan 18 '19 at 14:42
  • why not use the automator script to time it? or monitor the actual file? would seem to have many less issues – Sam Mason Jan 18 '19 at 14:43
  • @SamMason Can you explain me more . I couldn't get ur point . If you asking me to check actual file . How to do it ...? – Sreevathsabr Jan 18 '19 at 14:45

1 Answers1

0

I'd do something like this:

from time import sleep, time
from os import stat

filename = 'image.jpeg'

last = None
while True:
    s = stat(filename)
    if last and last != s:
        print(time(), s)
    last = s
    sleep(0.01)

i.e. use the standard file system stat to look for changes to the file 100 times a second…

seems to work when I've played

Sam Mason
  • 15,216
  • 1
  • 41
  • 60
  • Again the problem which I was telling is actual doesn't change till it is applied and saved . So How can we deal this ? So it's only preview which can show the change – Sreevathsabr Jan 18 '19 at 15:07
  • huh, the file changes when I drag the slider around (OSX 10.14.2). maybe add a save command to the automation script? – Sam Mason Jan 18 '19 at 15:17
  • Again some delay to save .. and check changes. . then we can follow screenshots it's self .. one question .. is there any to detect change in screen ? – Sreevathsabr Jan 18 '19 at 15:22
  • you really need to learn to search! https://stackoverflow.com/a/4525615/1358308 suggests that you're going to be "saving" an image anyway. why not just save the image you're interested in? resaving the image will give you the time for saving the image, which you can take off the "modification & save" time to give you just the time for the modification – Sam Mason Jan 18 '19 at 15:34