private static void WriteAndCheckProfile(IMagickImageCollection images, PsdWriteDefines defines, int expectedLength) { using (MemoryStream memStream = new MemoryStream()) { images.Write(memStream, defines); memStream.Position = 0; images.Read(memStream); CheckProfile(images[1], expectedLength); } }