This project has moved. For the latest updates, please go here.

Differences between Ping and Read

Jul 18, 2016 at 11:28 AM
For some image manipulations, I first need to check colorspace, what I'm doing with Ping function to avoid reading all pixels right now. If a specific colorspace is found, I need to process pixels. Should I have to use the Read method or the lib will guess that pixels needs to be read before modifying pixels and so will read them for me?

On the same kind. If I've read the pixels using the Read method, is there a flag to know that MagickImage object is already filled with the pixel data from a Read operation (already read) ? In my code, I'm doing multiple operations and I want to avoid dual reading of the pixels.
Jul 18, 2016 at 5:55 PM
Edited Jul 18, 2016 at 5:56 PM
The pixel data of an image will not be read on demand. When you call the Ping method you explicitly tell Magick.NET to not load the pixel data. And when you call the Read method you will always load the pixel data. You should follow up a call to Ping with a call to Read when you determined that you need the pixel data. And there is no need to call Read multiple times for the same image. I hope this answers both your questions.