I have a couple of images (.tif file) on which I want to perform the following commands:
-
Importthe image:img = Import["path/to/file/image01.tif"] -
Remove the alpha channel:
img=RemoveAlphaChannel[ColorConvert[img, "Grayscale"]] -
Convert the imported image to data:
rawImg=ImageData[img] -
Finally, plot the mean of the image values in the vertical direction:
ListPlot[Mean[grayRaw]]
As you can see, I am not asking for help about how to those manipulations on my image file. Let’s say I have a bunch of 10 such images, and I am looking for the most promising ListPlot of those.
One way I can do this is to get these 4 commands into one cell, and just change the image file name (image01.tif, image02.tif etc.).
But I would like to ask whether any one here in the community can give me a more systematic way of doing the manipulations above with a Wolfram Package file (.wl file). I read that this is the “more” correct way for developing Mathematica code (other than .nb files).
What about writing a function for doing these manipulations? Is that a good idea?
Thanks a lot!
