Questions tagged [netpbm]

Netpbm is a toolkit for manipulation of graphic images, including conversion of images between a variety of different formats

From the official project site at sourceforge:

Netpbm consists of over 300 separate tools including converters for about 100 graphics formats. The package is intended to be portable to many platforms. It has, at least at one time, been tested under various Unix-based systems, Windows, Mac OS X, VMS and Amiga OS. The maintainer uses and builds it on a platform that consists (in relevant part) mainly of GNU software (you probably know this kind of system by the name "Linux").

The goal of Netpbm is to be a single source for all the primitive graphics utilities, especially converters, one might need. So if you know of some freely redistributable software in this vein which is not in the package yet, you should bring it to the attention of the Netpbm maintainer so it can be included in the next release.

Netpbm does not contain interactive tools and doesn't have a graphical interface.

17 questions
4
votes
2 answers

Extra data within image (PPM/PAM/PNM)

Is it possible to store extra data in pixels of a binary PNM file in such a way that it can still be read as an image (hopefully by any decoder, but specifically by ffmpeg)? I have a simulation that saves its data as PPM currently and I'd like a way…
user328062
2
votes
1 answer

Transposing of Large and Narrow Images in C

I am trying to process large .pgm images in C. The images are first read in the format Image, as matrices of unsigned char elements: struct Matrix{ int rows; int cols; unsigned char * data; int widthStep; }; typedef struct Matrix Image; I…
Vylst
  • 45
  • 1
  • 5
1
vote
0 answers

Compiler error when building Netpbm program

I'm trying to build a specific program from the Netpbm library, specifically pamenlarge. When running make pamenlarge, I get the following error: pmfileio.c:216:22: error: implicitly declaring library function 'strdup' with type 'char *(const char…
Nick D
  • 11
  • 2
1
vote
2 answers

Get list of index values of pixels of indexed image

I would like to get the index values of an indexed image, so that I can modify images in a game where the palette and the index data are separate files. I looked through the command-line options of identify, the -grayscale options, the FX…
Johannes Riecken
  • 2,301
  • 16
  • 17
1
vote
1 answer

How to read .PBM binary in C

I need to read a .PBM image in binary (p4) for my school project. I tried something like this: for (int i = 0; i < img->height; i++) { for (int x = 0; x < img->width; x++) { c = fgetc(fp); ungetc(c, fp); lum_val =…
1
vote
1 answer

How to use pnmscale to scale the longer side of an image and still keep the ratio?

I'm writing a GNU Makefile to do some processing on images. One task is to scale the image (.ppm format) by a SIZE parameter using the pnmscale command. The image should be scaled by the longer side without loosing the ratio and should be saved…
Njeum
  • 13
  • 1
  • 4
1
vote
2 answers

Understanding NetPBM's PNM nonlinear RGB color space for converting to grayscale

I am trying to understand how to properly work with the RGB values found in PNM formats in order to inevitably convert them to Grayscale. Researching the subject, it appears that if the RGB values are nonlinear, then I would need to first convert…
Brandon Petty
  • 605
  • 1
  • 6
  • 15
1
vote
1 answer

Inverting bits of PBM image while vs for loop

I am trying to flip the color of pixels of a simple pbm image which has only pure black and pure white. I am generating the image myself and then reading it and then flipping the bits and saving both the generated image and the color inverted…
1
vote
1 answer

(Modern) tool for cropping an image file to an automatically-determined bounding box?

I need to crop white space (margins, etc) from diagrams where the rendering pipeline doesn't generate (reliable) bounding boxes. The margins are reliably white so automated detection is in principle trivial however the only existing tool I've…
Tom Goodfellow
  • 882
  • 8
  • 18
0
votes
1 answer

Reading binary PBM file ending with distorted image

I am trying to implement a C++ code to read a binary PBM file. Right now, after read the header of the file successfully (magic number, width and height), I got this code to read each character of the file, and extract the individual bits from this…
Kleber Mota
  • 8,521
  • 31
  • 94
  • 188
0
votes
2 answers

Converting from pgm to pbm but getting wrong output

I've written a program that takes a PGM image as input and converts it to a PBM file. However, the image I get as output is incorrect. I determine if a pixel is white if its value is bigger than (max+1)/2 then use putchar() to place the character…
0
votes
1 answer

How to read binary data from file after read sucessfully the ascii header in the file

I am trying read the Netpbm image format, following the specification explained here. The ascii types for the format (which have P1, P2 and P3 as magic number), I can read without problems. But I have issues reading the binary data in these files…
Kleber Mota
  • 8,521
  • 31
  • 94
  • 188
0
votes
1 answer

Does Netpbm formats pgm and ppm max value can be larger than 255?

I can't really find any documentation/information, so does netpbm formats support larger max values than 255 for color scaling and how does color scaling works anyway?
jovanMeshkov
  • 757
  • 5
  • 12
  • 29
0
votes
1 answer

Why does this pbm image behaves weirdly

I am trying to understand why I am not getting expected result from the following lines of code: pix=np.asarray(Image.open(File))) #I am reading a pbm file into memory img = Image.fromarray((pix), '1') #rewriting img.save("test1.pbm") newpix=~pix…
rivu
  • 2,004
  • 2
  • 29
  • 45
0
votes
2 answers

Reading input from a file in python 3.x

Say you are reading input from a file structured like so P3 400 200 255 255 255 255 255 0 0 255 0 0 etc... But you want to account for any mistakes that may come from the input file as in P3 400 200 255 255 255 255 255 0 0 255 0 0 etc... I want to…
somebody
  • 85
  • 3
  • 10
1
2