Questions tagged [ppm]
PPM is a pixmap image format used by the Netpbm library and other graphics software.
285
questions
0
votes
0
answers
19
views
Is there way to send ppm from arduino\esp to Flight controller by wire
I'm trying to make a simple AI for ESP8266 that generates a ppm signal depending on the incoming data and send it to drone by UART. What should I do to transmit this ppm signal to the drone via the ...
1
vote
0
answers
45
views
Making a PPM file in C that uses many shapes
So I'm working on a program that, ultimately, will create a simple image of a spooky pumpkin (square eyes, nose, rectangle mouth). Right now with my code I am generating a orange circle. The color ...
2
votes
2
answers
87
views
How to save rgb color to ppm file properly?
I try to make simple c program saving rgb color to ppm file usinf 1D array. It is educational project
#include <complex.h>
#include <math.h>
#include <omp.h> //OpenM
#include <...
-1
votes
1
answer
51
views
A simple java raytracer doesn't work and i have no idea why
I'm trying to write a simplest raytracer that will just output a circle to a PPM file yet i'm getting nothing.Problem is not with the PPM code and is with the ray code.I'm bad at math so i really don'...
1
vote
1
answer
72
views
C Function to create BMP file header from width and height
I need help filling out a BMP file based on the width and height of an image.
What I am working with:
struct BMP_Header {
char signature[2];
int size;
short reserved1;
short ...
0
votes
0
answers
144
views
PPM image file not opening in GIMP
Tried to write a simple PPM image file in C++, here is the code:
#include <iostream>
const int image_height = 256, image_width = 256;
int main()
{
std::cout << "P3\n" << ...
0
votes
0
answers
71
views
How can I store a P6 PPM File into a PPM struct in C?
I need to write a program that can store both a plain PPM file (P3) as well as a normal PPM file (P6). I am anyways unclear as to how a P6 PPM file is written, and so cannot figure out how to load it ...
0
votes
1
answer
90
views
Read header of PPM file only using getchar()
I need to read a PPM file but I'm limited to only using getchar() but I'm running into trouble ignoring whitespaces.
I'm using num=num*10+(ch-48); to read the height and width but don't know how to ...
2
votes
2
answers
1k
views
How to convert images from the jpg format to ppm(P3)
I have recently learned how to read ppm3(P3) images in C++. I just read RGB pixels written in a plain format. I want to convert some certain jpg pictures to ppm3 and then experiment with different ...
0
votes
0
answers
77
views
"Undefined reference to WinMain"
I'm currently working on a coding project and having some difficulties with this error message
ygwin/11/../../../../lib/libcygwin.a(libcmain.o): in function `main':
/usr/src/debug/cygwin-3.3.5-1/...
0
votes
1
answer
402
views
Simple way to read a mixed binary / ascii file in python?
I'm trying to open and interpret a P6 ppm image file by hand in python. A ppm p6 file has a few lines of plain ascii at the start, followed by the actual image data in binary (this in contrast to a ...
0
votes
1
answer
62
views
problems with buffer overflow with images in c
there! I saw a Youtube video, that was using C++ to create images. I decided to port it to C & it works like a charm. The tutorial teaches how to work with ppm files.
So then, I decided to turn it ...
1
vote
1
answer
134
views
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 ...
1
vote
1
answer
87
views
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 ...
0
votes
0
answers
157
views
Why does my jpg/png/bmp look darker than my ppm file even though they have the same pixels?
I encountered a weird problem: I converted a ppm file into png, jpg, and bmp. Visually, png, jpg, and bmp files look darker. I thought it was something wrong with the pixels so I use the following ...
0
votes
1
answer
50
views
Smoothed partial residuals of a covariate in a point process model in spatstat
I am using spatstat to build point process models using the ppm function but I have problems in validation, when I use the residual plot parres to understand the effect of a covariate.
The model is ...
0
votes
0
answers
149
views
F# - Convert PPM Image to Greyscale
I am new to F# and was wondering if there is a way to convert an image in ppm to grayscale using F#?
0
votes
2
answers
285
views
Is there a way to convert P3 ppm to jpg in python?
I have a ppm image file and i want to convert it to a jpg but the problem is that the ppm is p3 and i only know how to convert p6 to jpg and don't understand how the conversion from p3 to p6 works or ...
0
votes
1
answer
58
views
Why Strauss model restricts gamma < 1 but Strauss-Hard allows gamma > 1?
I'm very confused about why the Strauss model only allows 0<gamma<1 while it's okay to have gamma>1 in Strauss-Hard to represent the clustering behavior of points. What is the mathematical ...
0
votes
0
answers
243
views
Can't create ppm File from an executable (C)
I am trying to create a ppm file from inside a C program, but somehow it doesn't work.
It works fine when I am inside the IDE and run the program there. The program is executed and the file created ...
1
vote
1
answer
85
views
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 ...
0
votes
0
answers
449
views
ppm file read error using C in Visual Studio 2019 IDE
I am trying to read ppm files called bridge.ppm or retina.ppm and display them using a C program on a windows machine using Visual Studio 2019. Whenever I am trying to read the file using fopen I get ...
1
vote
1
answer
217
views
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 ...
0
votes
0
answers
29
views
C++ Program crashed after reading ppm file row by row [duplicate]
I'm writing a program to read from a .ppm file and store their values. This code that I wrote worked, but it just crashes (break?) right before closing the file. Can someone please help me find out ...
0
votes
1
answer
469
views
How to encode RGB values for a P6 ppm?
I'm trying to create a ppm image file using the P6 encoding. I'm using this code to create the file:
private static void writeImage(String image, String outputPath) {
try (PrintWriter out = new ...
0
votes
1
answer
240
views
Python - Ppm value RGB in a matrix without library
I'm trying to recover separately value R, G & B from a ppm file in three different matrices.
I wrote this script :
#Read file
feep_file = open("feep.ascii.ppm", "r")
def ...
0
votes
1
answer
1k
views
How do I draw and write to a ppm file?
I want to draw lines/shapes and output to a ppm file, but I don't know how to even draw individual pixels. I know how to output to a file and that there's a nested for loop method for drawing pixels (...
1
vote
1
answer
1k
views
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 ...
0
votes
1
answer
79
views
PPM image gets distorted when writing binary data but does not when writing string (ASCII)
i have pointer to data buffer.
when i write PPM image using string (ASCII), it's written successfully without any distortion.
https://i.stack.imgur.com/TYAFY.png
but when i do the same thing but write ...
0
votes
0
answers
288
views
How Can I parse a PPM file and store RGB values in three separate 2D arrays?
My code tries to loop through the PPM file and is supposed to ignore the header information. Once it is done, it is supposed to add red, green, and blue numbers to 2D int arrays. The x and y values ...
0
votes
1
answer
246
views
Error when calling os.rename(): "The process cannot access the file because it is being used by another process"
I'm trying to use the script in this wonderful medium post to scrape some text out of a bunch of pdf's. I'm getting an error in the pdf_extract function on os.rename() that reads as follows:
The ...
0
votes
2
answers
70
views
I don't know why the file won't open
This is my code
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#define TRUE 1
#define FALSE 0
typedef struct {
int M,N;
int min,max; ...
1
vote
1
answer
576
views
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
votes
1
answer
304
views
.ppm image mirrored is upside down and low quality
I have this program that should mirror a .ppm image.
however, it produces an upside down mirrored image. how can I prevent it from flipping the image upside down?
code:
takePPM = input("Enter the ...
0
votes
1
answer
223
views
How do I initialize values of a 2d array of structs?
Im writing a ppm file with a 2d array of structs which act as the rgb values. The file writes, but when I try to pass the struct which contains the color value I want through my drawRect and ...
-1
votes
1
answer
64
views
Vertical gradient formula [closed]
I want to write a C program that produces 1000x1000 .ppm file, showing a vertical gradient from black(left) to white (right). Now, if the picture would be 256x256 it would be easy:
P3
256 256
255
0 0 ...
0
votes
2
answers
158
views
Is this not that way to make an Italian flag .ppm file? [closed]
This is my code to create an Italian flag .ppm file:
#include <stdio.h>
int main() {
int width = 800, height = 600, i, j;
printf("P6\n");
printf("%d %d\n", width, ...
-1
votes
1
answer
1k
views
how to recover lost AWS .pem file and putty key, which are lost due to any virus
Yesterday I downloaded Filezilla, after the downloading, I got warn message from my computer, and when I checked the download folder, all data were deleted including putty key and .PPM file. could ...
0
votes
1
answer
1k
views
C program for steganography
Relatively new to programming, been assigned to a task to create a C program to encode and decode 2 ppm images to receive a secret message. I've came up with code but its not getting past the image ...
0
votes
1
answer
172
views
Convert an uploaded .PPM file to .PNG in PHP without installing ImageMagic or any other PHP module in Linux
I have a form in which a user is suppose to upload a .ppm file and I am suppose to convert the file to a valid .png file at the time of the upload.
I know how to do so with ImageMagic but in this case ...
0
votes
0
answers
96
views
Why I can not write .ppm P3 file with fwrite on a buffer in C++, only hard-coded text?
Here is the code, but I get error, black image..
FILE* fp = fopen(filename, "wb");
//fprintf(fp, "P3\n4 4 \n255\n 168 50 50 168 50 51 168 50 51 15 0 15 0 0 0 0 15 7 255 ...
1
vote
0
answers
276
views
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 ...
1
vote
1
answer
174
views
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. ...
0
votes
0
answers
340
views
Fread read wrong number of valid bytes C
I read two ppm images and I have a struct that stores all the informations (magic number, width, height, level of colors, and pixels). I read the pixels using fread, but the problem is that we have ...
0
votes
1
answer
644
views
Read PPM iamge file (P3) and write the output in a FIle using C
readData should read an Image struct from a .ppm file, write data should write an Image struct in its PPM format to standard output, and free image should free an Image object.
This is what I tried ...
1
vote
1
answer
105
views
Writing a 1D binary array of size N to a (N/2, N/2) size PPM image
I have the following code
'''
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
void main()
{
int n = 32;
int* img = malloc(sizeof(int)*n*n);
for(int i = 0; i <...
0
votes
0
answers
64
views
Is PPM format industry standard?
I am trying to understand at a fundamental level how the pixel data for images and videos are generated. I came across the use of the PPM protocol where each value of the pixel (RGB) is written in the ...
1
vote
0
answers
198
views
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 * ...
0
votes
1
answer
828
views
PPM wrong color display
I get weird results when displaying a PPM:
pixeldisplay
(this is actually an upscaled PNG)
And here's what the file looks like:
textdisplay
The dimensions are fine (10 rows, 8 columns), just the ...
1
vote
0
answers
518
views
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 ...