Map<String, dynamic> toJson() { return <String, dynamic>{ 'buffer': buffer.toList(), 'width': width, 'height': height, 'bitsPerPixel': bitsPerPixel, 'bytesPerPixel': bytesPerPixel, }; }