Edit post image attributes on fly?

When post data is inserted into database it is passed through wp_insert_post_data filter in wp_insert_post() function (source).

According to documentation you can check for set ID argument to distinguish posts being updated from posts being created.

tech