开发者

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 开发者_Go百科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.


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

convert xx.ppm xx.png

or use Imagemagick's dll API


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


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


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


You can use ImageMagick library :

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

but it does lots of other things.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜