Fixed issue with transparency trimming

The previous implementation was assuming little endian values.