Questions tagged [ppm]

PPM is a pixmap image format used by the Netpbm library and other graphics software.

Portable Pixel Map (PPM) is a simple format for 24-bit color images.

The format allows data to be stored in either ASCII or binary format. PPM is the native format of the Netpbm graphics library and the format is described on the Netpbm web site. It is part of a family of formats including , , and , collectively tagged (the original name for what is now the Netpbm library).

280 questions
2
votes
2 answers

PPM Images in Android

I'm trying to open .ppm images (Portable pixmaps) in Android. I've deciphered the format enough to create this: public static Bitmap ReadBitmapFromPPM(String file) throws IOException { //FileInputStream fs = new FileInputStream(file); …
Anthony
  • 7,638
  • 3
  • 38
  • 71
2
votes
1 answer

Reading RGB values from a ppm file & storing them into a 2d array called "Image" using a struct (dynamic arrays)

I am trying to read from a ppm file and extract the RGB values and store them into a 2d array w/ C++. I'm pretty sure the solution is pretty simple but for the life of me, I cannot see it. All of my attempts yield a ton of errors. Edit: Values in…
user10500932
2
votes
1 answer

How to do a black-and-white picture of a ppm file in C?

hey I need a little help with my code, I read a ppm file, change the colors to black and white and want to save it to a new file. I could read the header of my file and write it to the new file but I've struggles with changing the colors. I know…
newlearner
  • 149
  • 1
  • 11
2
votes
1 answer

How to pixelate an image

I am attempting to pixelate a P6 PPM format image via the following steps: Read a PPM image in grids of 4x4 Find the average RGB colour value of each 4x4 grid Write to a new file by setting each 4x4 grid of pixels in the new image to have the…
p.luck
  • 646
  • 2
  • 9
  • 34
2
votes
2 answers

Convert image to CSV

What is away to break up an image into a grid of square cells, color each cell with the average color it contains, and export the resulting averages as a csv file? Since ppms are simple image formats, conversion to ppm format may be a good place…
Caleb
  • 148
  • 7
2
votes
1 answer

Problems printing out an array for a ppm file

I am trying to create an array using a struct in order to create a ppm file. I then want to call other functions in order to change the color values (rgb) for each cell to make shapes. This is as far as I got trying to print out an array with three…
Calarax911
  • 35
  • 4
2
votes
1 answer

Mandelbrot image generator in C++ using multi-threading "overwrites(?)" half the image

I don't really know how to explain my problem properly, but hopefully you can understand it using the images i provide. I made this Mandelbrot image generator using a template and a tutorial on the internet, and i'm trying to make the generation…
P. Protas
  • 416
  • 4
  • 15
2
votes
2 answers

Cropping a .ppm file in C

I'm working on a C program that crops .ppm files from a starting point pixel (x,y) (top left corner of cropped image) to an end point pixel (x+w,x+h)(bottom left corner of cropped image). The data in .ppm files is of the following format: r g b r g…
endmade
  • 159
  • 1
  • 4
  • 9
2
votes
1 answer

Android GIMP JPG to PPM conversion

How exactly does GIMP convert a jpg into a ppm? I'm trying to convert a jpg to a ppm on Android. In Android I use the API to create an ARGB_8888 Bitmap of the jpg then drop the Alpha channel and throw the RGB values into a ppm. But I get different…
Jay
  • 323
  • 1
  • 3
  • 13
2
votes
3 answers

Converting ppm file from P3 to P6 using C

I am trying to write a program that converts a p3 PPM file to P6 using C. But I am running into two problems. 1, I am getting a segmentation fault in my code. and 2, the header isn't being properly read into the converted p6 file. Here is my header…
Harrison
  • 23
  • 1
  • 6
2
votes
6 answers

Importing PPM images with python and PIL module

I need a way I can read the lines and extract the pixel info into some structure so I can use the putpixel function to create an image based on the ppm p3 file. I'm working with Python Imaging Library (PIL) and I want to open a PPM image and display…
andrepcg
  • 1,301
  • 7
  • 26
  • 45
2
votes
1 answer

Issues reading ppm p6 image to completion. c++

int main(){ std::fstream myfile; // file object is created myfile.open ("green.ppm"); std::string line; unsigned red,green,blue; //to output values on 0 -255 scale. int width, height = 0; if (myfile.is_open()) { …
2
votes
0 answers

PPM Image Transformations in C++

I am stuck on how to perform these transformations on a PPM image. This is what I have so far, these are close to the solution but a few pixels are wrong for each of them, and I have no idea why? void vertical_flip(PpmImage &ppm) { for (unsigned…
DBoyer
  • 3,062
  • 4
  • 22
  • 32
2
votes
5 answers

Color Reduction - Only Reds are generated

I am trying to reduce the color of a ppm image file from 255 colors to 5 colors(red, blue, green, black and white). When I initiate my test file, the pixel_list generated is only reds, which is not correct. I'm using the Euclidean distance formula…
Wakedude
  • 53
  • 2
  • 11
2
votes
1 answer

Reading a P6 binary ppm file

So ive already read a number of the questions that relate to this but none of them have solved my problem. Im currently attempting to read in a P6 ppm file (Its a binary file). My current code…
TheQAGuy
  • 498
  • 7
  • 17
1
2
3
18 19