I observed this difference when processing gray scale image. I wondering what could be causing this difference. Does photoshop applies addtional steps before or after applying the same action?
Another issue I'm having is that after I batch process a bunch of images, one of the images (all png) cannot be openned in Matlab where I want to do more process. I'm not sure what is causing this issue.
Bug, FAQ, Import and export, Problem or error, Windows
Grayscale is tricky. You need to watch your grayscale profiles. Grayscale is color managed in Photoshop just like RGB files. But outside Photoshop, all bets are off - grayscale color management is virtually non-existent.
To get reasonably predictable results outside Photoshop, you need to use a grayscale profile that matches the destination as closely as possible. For screen work, that means Gray Gamma 2.2 or sGray. For print there are many special considerations I won't go into here - but generally, Gray Gamma 2.2 should be a fairly safe choice.
If you have grayscale files without an embedded profile, your working gray gets assigned. That's already a problem, because the Photoshop default dot gain profiles are virtually useless for any practical purpose. They are basically outdated generic profiles for offset print (for which there are much better solutions today).
My general advice is to avoid grayscale if possible. But if you have to, convert to Gray Gamma 2.2 for general use. Make sure that profile is embedded in the file throughout (which may be where your batch trips up).