Questions tagged [pgm]

PGM is a grayscale image format used by the Netpbm library and other graphics software.

Portable Gray Map (PGM) is a simple image format for grayscale images.

The format allows data to be stored in either ASCII or binary format. PGM 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).

175 questions
0
votes
0 answers

Convert a buffered stream to pgm in nodejs

Is there any way or a library to convert a buffered stream to pgm image format in nodejs. I've searched online but haven't seen one. Kindly guide
hopeforall
  • 401
  • 1
  • 6
  • 20
0
votes
0 answers

Save a PGM image in C

I have an array 230x230 contains values: zero (black pixel), and values from 25 till 1200. I want to save this array as PGM image. I made the image header: P5, 230x230, 255 (as maximum value), and I wrote the array values without changing. This gave…
0
votes
1 answer

How do I rotate a pgm file clockwise?

I have tried many things and can't get it right. I know that the first row = the last column, but don't know how to swap the two. void pgm_cw(vector& p) { int rows = p.size(); int cols = p[0].size(); vector temp; //2nd vector to…
user9059672
0
votes
1 answer

How to use TStream to fill a matrix of integers

I'm trying to read a PGM binary file (http://netpbm.sourceforge.net/doc/pgm.html) to fill a 0-based 2D matrix of integers (16-bit grayscale values). The file may be 50 megs, so I'm trying to fill a buffer in one call. I've never done anything with…
RobertFrank
  • 7,332
  • 11
  • 53
  • 99
0
votes
0 answers

convert pgm 12bit/px to pgm 5

I'm generating a disparity map using pgm files, the file type is 12bit/px. I faced an error, it says "wrong magic number, only P5 PGM files supported" Is there any solution? can I convert to PGM? Thanks
0
votes
1 answer

Java Image Processing using PGM files and Multi-Dimensional arrays

I'm in a intro CS class. We've been given a project where we've been supplied a basic file, and a few .PGM files of our school's mascot and things like that. Basically we're told that we need to use the framework they've written, and flip, rotate…
DanielJackson
  • 41
  • 1
  • 4
0
votes
1 answer

ansi-c. High-Pass3 filter for .pgm pictures

I'm wandering through the web and none of tutorials I've read I don't really understand. How do I implementation of High-pass3 filter for .pgm pictures? I've struct of Image: struct Image { char* file_name; //name of .pgm file char header[3]; …
TrN
  • 1,230
  • 2
  • 17
  • 32
0
votes
1 answer

Segfault in an unusual place

I was writing some code to make a .pgm image for my class, and when I ran it for the first time, I got a segfault. I kinda expected that, because I'm notoriously bad about calling a member of a struct that was initialized to NULL. But when I put my…
0
votes
1 answer

Write 2D array to PGM grayscale image

I'm creating various 2D arrays of sizes from 100x100 to 2000x2000 elements. The values within the arrays can be clamped down to 0 - 255 gray scale and then need to be written to a PGM image in order to visually represent the data. For example, I'm…
KHB
  • 1
  • 1
0
votes
0 answers

Writing to a .PGM file using C++

For some reason, I can't write anything to a .PGM file. The following code compiles without errors but nothing is written to the .PGM file it creates. I'm fairly new to C++ and pretty unfamiliar with working with strings in this syntax. #include…
Rice
  • 17
  • 1
  • 8
0
votes
0 answers

How to create a (or modify an existing) pgm 5 file in C?

For example say I want to create a 100x100 pgm file, how do I proceed? It's different than creating and modifying a text file as I'll have to open it as binary.
0
votes
1 answer

OpenCV Python - Reading pgm files

I'm trying to read a bunch of pgm files for a facial recognition project. These files lie in an overall folder called "negative" and within the negative folder are subfolders. This portion of my script is supposed to go into all of the directories,…
bladexeon
  • 696
  • 3
  • 10
  • 31
0
votes
1 answer

How to read in pixel values from .pgm file and copy it into an array. c-programming

I've been stuck on this for a while. How would I go about copying pixel values 0-255 from a pgm file into an array? This is what I have so far. I know I'm off from what it is suppose to be. #include #include int main(int argc,…
G. Gary
  • 25
  • 7
0
votes
1 answer

How to .setColor() as a PGM value

How can I take the values from a PGM file, set the value as the color, then use that color to fillRect()?
0
votes
0 answers

Reading and Writing Raw PGM Files in Java

I am trying to read and write PGM Files. Working with ASCII PGM (Magic number = P2) is easy, but I am having some confusion in working with Raw PGM Files (magic number P5). Here is the PGM file that I am trying to read : A.pgm After PGM Header, when…
cnova
  • 725
  • 2
  • 9
  • 22