Image Operations

I just wanted some advice first in this regard. I do understand taking image and loading. My query is, if I have an image and I load it in a variable x then does it mean that I am storing the matrix of the image there ? Is it possible then that I consider it as an array and then do further operations if required?

This is my sort of first time working with images and I am kind of clueless here. Any help or guidance will be of extreme help.

Thanks in advance!

Storing the image pixel data as vector or matrix is often how it works, but it's possible to just load the metadata or to have an image format and/or library that works with scanlines or tiles to facilitate requiring less memory for large files. Also image libraries often have a layer of abstraction over the data in order to remain flexible and easier to use at a high level. Depending on what you're trying to do, e.g. draw shapes, there may also be a library that does it for you.

The popular image crate has an ImageBuffer type as one such abstraction, but you can also access the underlying [sub-]pixel data directly as a slice.

You can read up more in the documentation and README for the image crate, including the imageops module. Some more experimental / less stable (but not necessarily uncommon) operations are also maintained in the imageproc crate.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.