Updated image writer for inputstream and byte array methos