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
1
vote
1 answer

Create/Save PPM-File from unsigned char* AND unsigned short* Pointers (RGB) (C++)

I need help saving a PPM file in C/C++. I want to save an PPM image from the three basic color channels. The channels are represented as void * pointers (pRed, pGreen and pBlue). Those values are fixed so I cannot change them. There is one more…
manfred reichelt
  • 137
  • 1
  • 3
  • 9
1
vote
1 answer

Reading and writing .PPM image in java?

I have to read a ppm image in java and then convert the image to negative. Then PPM image has a magic number "P6" and then a # Comment char, and then height and width. and finally has 255 character, that is followed by data. i want to read header…
Asghar
  • 2,336
  • 8
  • 46
  • 79
1
vote
1 answer

Using Bresenham’s algorithm to create a line

I'm running into an issue where a line can be drawn if the slope is less than 1, but once the slope is greater, the line still draws a slope of 1. (0,0) to (70,25) (0,0) to (25,70) I'm following some specific pseudocode, which is why I have so many…
1
vote
1 answer

Why is my sprite not loading and my screen only displays white?

I am using openGL and C to load a sprite as a ppm file, I use Gimp to turn a png into a ppm and then I turn it into an array and add commas it to make it readable in C. In the ppm file format there is the red green and blue values of each pixel…
Saw
  • 115
  • 1
  • 16
1
vote
1 answer

Storing Comments Of PPM File In Linked List

I am trying to read a PPM File and store the comments in a linked list so far I have created a structure of Node with value and struct pointer to next node. Also created an append function and also a print linked list function. But when I try to…
1
vote
1 answer

Reading In PPM Pixels As RGB Integers

So my code involves reading in a PPM image and then storing it in an array so it can be saved in an new ppm file. Though I think there is a problem with my pointers that means its not actually reading the file. Also my code ends after allocating the…
1
vote
1 answer

Write a function ImageLoader to read the contents of a PPM file in P3 format using C++

I am completely lost and frustrated trying to read from a PPM file. I understand how to open the file, and how to access the magic number, the width and the height, and the max color value. I am struggling to understand the process behind reading…
Zayum
  • 79
  • 7
1
vote
1 answer

Reading an image (PPM) with C

So I have to read this image in a PPM format, and then write it to another file. It works, however if the image has comments it stops working. If the image is like this: P3 3 2 255 255 0 0 0 255 0 0 0 255 255 255 0 255 255 255 0 0 …
1
vote
0 answers

Array to image alternatives

For a project, I'm using the MLX90461 IR camera. And I'm using some C++ code to read the data of the camera. The data of this camera is stored in an array of 192 elements (16x12 RES). In this array, I store the measured temperature for that…
Stefan de Kraker
  • 333
  • 4
  • 14
1
vote
1 answer

C not entering For Loop which merge 2 PPM images

I have gone absolutely mind numb trying merge two PPM images of the same type and size together. My code can read, display and save PPM images but won't enter the for loop which combine two images. Here's the combining function: struct MFI…
Eve Pitt
  • 23
  • 4
1
vote
1 answer

Writing a 1D binary array of size N to a (N/2, N/2) size PPM image

I have the following code ''' #include #include #include void main() { int n = 32; int* img = malloc(sizeof(int)*n*n); for(int i = 0; i < n*n; i++) { if(i%n < n/2) { img[i] = 0; …
1
vote
0 answers

PPM Image flip using a one-dimensional vector C++

for(int i = 0; i < hdr.getHeight(); i++){ for(int j = 0; j < hdr.getWidth(); j++){ Pixel temp = vec.at(i * hdr.getWidth() + j); vec.at(i * hdr.getWidth() + j) = vec.at(i * hdr.getWidth() + ((i * hdr.getWidth()) - j)); …
1
vote
0 answers

PIL having trouble reading PPM image file

I'm creating a GUI for my program, and I'm attempting to display a user selected ppm image file. When using the Image.open() method on a selected ppm file I get this error Exception in Tkinter callback Traceback (most recent call last): File…
1
vote
1 answer

Error while reading ppm file in python using PIL

import os import glob from scipy.misc import imread from PIL import Image class NpyGenerator: def __init__(self, directory): if not os.path.isdir(directory): raise ValueError('The argument is not a valid directory') …
Dhruvin Naik
  • 89
  • 2
  • 15
1
vote
1 answer

Peculiar problem regarding convolution in PPM format

After debugging, trying different image softwares (xdg, gimp) I persist to have a bug which throws me off completely. Problem is about convolution in PPM format, for images different in aspect ratio, I'm using 1500x1000px image, where mask of…
Kaaame
  • 11
  • 3