DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Question concerning a program for converting RAW pictures to PGM file formats...  (Read 8,029 times)

Renox

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 58
Ok, so... I am writing a nice little utility to convert a RAW picture file to a PGM file. Everything works great. Coding came out nice and it does exactly what I need it to do. However, I was wondering if there is anyway to convert a PGM file to JPEG format using C.

Renox

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 58

gjehle

  • lonesome linux warrior
  • Member
  • Joined in 2006
  • **
  • Posts: 286
    • Gathering Badge
i sure hope you used dcraw for raw conversion, otherwise you might have re-invented the wheel

the basic idea for image conversion usually is:
- load format x (this should give you a bitmap)
- convert said bitmap to destination format y

i recommended using libjpeg (http://freshmeat.net/projects/libjpeg/)
just spare yourself the effort of reinventing the wheel :P

esp. for image processing algorithms the already existing solution is magnitudes
better/faster than what you would come up with.
unless you're a image processing god, or the problem is very special ;-)

Renox

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 58
Thank you very much for the reply. I was wondering if anyone knew how to do this. I did, unfortunately re-invent the wheel so to speak.... I wanted to understand the data flow of the arrays for the actual image and the template it holds. I am still playing with things...

gjehle

  • lonesome linux warrior
  • Member
  • Joined in 2006
  • **
  • Posts: 286
    • Gathering Badge
well, it is a good thing to know how stuff works
sadly, most of the time one doesn't have the time (or virtue) to dig into the details.
esp. if you're coding stuff at work where money and time matters ;-)

Original address: https://www.donationcoder.com/forum/index.php?topic=10087.0