Create a 2D array of size 14x14 having same values ranging from 0 to 255 in each row. You are free to specify the values of this array. For instance, consider a 3x3 array as; Array [3] [3]= {{12,12,12}, {75, 75, 75}, {247, 247, 247}} 12, 75, and 247 pixel values are specified in a way that they are in a range of 0 to 255 and they are same in a row. Write a code namely arraytoimage.c using any pgm (portable gray map) format image that represents an image in a text file in which each pixel is represented by a number ranging from 0 and 255. In this code, write: -P2 (magic number) -Width and height of the image -Maximum grayscale value -Gray scale intensity values you specify in the array in an order to this image
Create a 2D array of size 14x14 having same values ranging from 0 to 255 in each row. You are free to specify the values of this array. For instance, consider a 3x3 array as;
Array [3] [3]= {{12,12,12}, {75, 75, 75}, {247, 247, 247}}
12, 75, and 247 pixel values are specified in a way that they are in a range of 0 to 255 and they are same in a row.
Write a code namely arraytoimage.c using any pgm (portable gray map) format image that represents an image in a text file in which each pixel is represented by a number ranging from 0 and 255. In this code, write:
-P2 (magic number)
-Width and height of the image
-Maximum grayscale value
-Gray scale intensity values you specify in the array
in an order to this image
![width = 256
width = 256 pixels
3
253
254 255
0 1 2 3
1 2 3 4
4
253 254 255
....
5
253
254
255
....
1 2 3
4
253 254 255
height =
256 pixels
....
...
1
2
3
4
5
253
254 255
(A)
(B)
Figure 1: Values in the grid represent the grayscale intensities of the image on the right.
(A) Intensitiy values shown in a grid of same dimension as image (B) Image as seen on monitor
: .
...
..
. ..
..
1-
. .](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F92c3ace9-605f-44f0-b702-0a3d48487f99%2Fd0ee0523-e8b8-478c-b118-fa45a085c7d5%2Fefd6bye_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)