SO discusses a number of related issues that discuss ways to change the image. Here are two common approaches:
1. Change the image data directly: I discuss this in my answer to this other SO question . Because image data can be 2-D or 3-D , you can use multidimensional indexing to modify the raw image data by creating rows along specified rows and columns. Here's an example that changes every 10 rows and columns of an image to black:
img = imread('peppers.png'); %

And now the image data in the img variable has black lines on it, and you can write them to a file or do any other processing you want.
2. Build the image and lines, then rotate the axis / figure into a new image: The zellus answer link shows an example of how you can build an image and add lines to it. However, if you want to save or process the displayed image, you need to save the displayed image as an image matrix. How you can do this has been discussed in these other SO issues:
- How to save a modified image in MATLAB?
- Rotate Matlab Graph into Image
gnovice
source share