Harshad Kshirsagar
Harshad Kshirsagar

Reputation: 511

Converting ppm to png

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.

Upvotes: 27

Views: 40758

Answers (5)

user2401543
user2401543

Reputation: 1149

you can use ffmpeg, for batch conversion you can do

#!/bin/bash
for i in *.ppm;
  do name=`echo "$i" | cut -d'.' -f1`
  echo "$name"
  ffmpeg -i "$i" "${name}.png"
done

Upvotes: 5

Mark Setchell
Mark Setchell

Reputation: 207425

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

Upvotes: 17

joni
joni

Reputation: 5462

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

convert xx.ppm xx.png

or use Imagemagick's dll API

Upvotes: 40

Goz
Goz

Reputation: 62323

Well GDI+ does not natively support the PPM format. So you will need a library whatever you do.

Upvotes: 0

BЈовић
BЈовић

Reputation: 64223

You can use ImageMagick library :

http://www.imagemagick.org/script/index.php

but it does lots of other things.

Upvotes: -1

Related Questions