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
0 answers

Xlib - Problems taking an screenshot

I'm developing a C++ program that takes an screenshot with Xlib. First of all I open the display and I get an XImage pointer with XGetImage(). After that I can get all the pixels with XGetPixel(). It returns a decimal value, so we have to convert it…
pirobtumen
  • 176
  • 1
  • 8
2
votes
1 answer

C does not go to the next line while reading .ppm

So I have a .ppm file and the goal is to read each pixel to corresponding r[] g[] and b[] elements. The code reads the first line (idk correct or not), but it does not go any further. I'm unsure if I need these getc(fp); in order to skip spaces.…
2
votes
2 answers

Convert PPM to JPG or BMP in java

I need to know how feasible is it to write a function in java to read a ppm file and convert it to jpg or bmp format. Anyone has experience with this? I am able to achieve the goal using tools such as ImageMagick but I want to do it in pure Java…
Vombat
  • 1,156
  • 1
  • 15
  • 27
2
votes
2 answers

Why does my PPM image's body contain symbols?

My PPM image contains the following : P6 1200 670 255 ܒNԪjɝ[؋Cц:̈6y5"r-¼,ֈ?Ԛ_݈׵̻֬كڕÒɪxڇՄmxɘl܊؇euί\jĩqÿHqAʻK΃PùG9EʁM͂M΂O̿PɼLȀMǃOǁLƾH»D5A®>ǷFxCٲ;yFƾIǿJʀL»GڲAʂWǯŐĕх՜џᔡ嚪矱Ԫׄ࠘ĝц׶Qfһψ΅e{ڈڗÖܻԡȜׂӐ}˸_hؖ`­u؛dьWЋV̓MͺHυPƽF˂I߼>ٹ6}>س5>Eiuƻ1 and 40000 more lines of…
Dionysis Nt.
  • 955
  • 1
  • 6
  • 16
2
votes
2 answers

My perlin noise looks like wrong, almost like grey t-shirt material (heather). Why?

I tried a quick and dirty translation of the code here. However, my version outputs noise comparable to grey t-shirt material, or heather if it please you: #include #include "perlin.h" double Perlin::cos_Interp(double a, double b, double…
Stumbleine75
  • 391
  • 2
  • 7
  • 22
2
votes
1 answer

Diagonal line in PNM P6 not drawing correctly

I am currently writing a program for an assignment that requires a single black line to be drawn perfectly solid diagonal (so that all x=y) from the upper-left corner of a standard PNM P6 file. I have had no issues with file I/O. However, I cannot…
2
votes
1 answer

How to draw image using RGB?

I've got semi-working code here. I'm getting a bad draw, the image doesn't draw correctly. I'm reading into an array RGB values (ppm format). I'm not sure what I'm doing wrong, but here's my code & pic (its supposed to be a red Lancia Stratos) :…
stryk3r1215
  • 41
  • 1
  • 7
2
votes
1 answer

Parsing PPM images in Haskell

I'm starting to learn Haskell and wish to parse a PPM image for execrsice. The structure of the PPM format is rather simple, but it is tricky. It's described here. First of all, I defined a type for a PPM Image: data Pixel = Pixel { red :: Int,…
reish
  • 831
  • 7
  • 18
2
votes
0 answers

extract/convert a jpeg image (from a buffer in memory) to rgb

i am writing a c/c++ program and i need to take images from a buffer in the memory and transform in RGB, that is 3 components of the image. I was looking at the libjpeg library, but i didn't find any tutorial or example. thanks
user2501133
  • 43
  • 2
  • 5
2
votes
2 answers

Printing a 2d array in haskell

I'm messing around with printing a random 2d array of Ints, in this simple image format (PPM) 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 Below is my code, which works, but seems like way too much code for such a simple operation. Is there a…
Ben
  • 84
  • 1
  • 7
2
votes
2 answers

C - Mirror a PPM from left to right

I have to write a program where I take user input for a PPM image and then mirror the image from left to right (basically flipping it over the y-axis). So if the image was <, the new image would now be >. This should not be a 180 degree rotation, as…
Austin
  • 73
  • 1
  • 5
2
votes
0 answers

SDL Putting pixels on the screen C++

I am starting with SDL, and I was reading the introduction, and I am trying the drawPixel method they have. What I am doing is a ppm viewer, so far I have the rgb values in an array and are correctly stored (i checked them by printing the array and…
hakuna matata
  • 3,243
  • 13
  • 56
  • 93
2
votes
0 answers

Rotating a PPM Image 90 degrees

I need help rotating a PPM image in C. The rotate function is supposed to rotate the image of a previously read in PPM image 90 degrees to the right. The code will be posted below. I need help with the rotate() function. The signature of the…
user1886597
2
votes
1 answer

Function to move 2d-array elements in python to their "opposite" side

I'm currently writing a program for school that will allow me to load a .ppm file into main and then run a series of functions that will allow the user to manipulate the image file displayed (which is also done via another function) in various ways.…
Pyrok
  • 53
  • 1
  • 7
1
vote
1 answer

Reading pixel data of a PPM file using C

I am trying to read pixel data from a PPM file. I have a function to read the header so I know it's pointing to the beginning of the pixel data. I tried using fgetc(file) but if the value is more than one digit it will not work. I also tried using…
Sams
  • 197
  • 1
  • 3
  • 14
1 2
3
18 19