I noticed that the "export to files..." from the script in Photoshop(currently using CS 6) is doing some unnecessary layer merging. If you have some layers at root levels and in between them you put a group containing a layer, that layer will be merged and exported with the first layer. If you put the group as the last layer, that layer won't be trimmed and will be exported the size of the psd file.
but then, all is fine if you put no layers at the root level(well from what I noticed) and everything in groups.
it's a weird behavior, not sure what is wrong with the algorithm. If you have any idea it would be appreciated.
You could ask for help over at
if you want to edit the Script to fit your intentions.
But it’s a rather lengthy one, so you might be better off creating a custom Script (with fewer options).