Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting ppm to png

Tags:

c++

image

In Linux I am getting .PPM files as the image format, this needs to be converted to PNG and then saved. I was looking at some API's to achieve this conversion from PPM to PNG. Can this be done using GDI+, as this would become native?

If that is not possible then I think freeimage or pnglib can accomplish that, however I would prefer to use native gdi+ if possible.

like image 285
Harshad Kshirsagar Avatar asked Oct 25 '10 08:10

Harshad Kshirsagar


People also ask

What is a PPM image?

A PPM file is a raster image saved in the Portable Pixmap format. It contains plain text that specifies the image's type (plain or "raw"), its number of columns and rows, and its maximum color value.

Can Photoshop open PPM?

With Adobe Photoshop, you can open a PPM file and then convert it to another format.

What is ppm PDF?

PPM is a simple format for storing images portable pixmap: color (PPM), grayscale (PGM) and black and white (PBM). These formats can provide an intermediate representation of the data when converting raster image files listed three types between different platforms. PPM format was developed by Jeff Poskanzerom.


2 Answers

Quick and dirty: download Imagemagick and use it from CLI:

convert xx.ppm xx.png 

or use Imagemagick's dll API

like image 165
joni Avatar answered Sep 21 '22 21:09

joni


Whilst ImageMagick will happily do what you need, it is actually a sledgehammer to crack a nut, and considerably more cumbersome and space and time-consuming to install than the NetPBM suite.

With that, you would do:

pnmtopng image.ppm > result.png 
like image 27
Mark Setchell Avatar answered Sep 23 '22 21:09

Mark Setchell