o
odinpkg.dev
packages / tool / ppm2jpeg_fast_image_converter_in_Odin

ppm2jpeg_fast_image_converter_in_Odin

53a5d14tool

A simple tool that works even with image files of big dimensions.

No license · updated 8 months ago

ppm2jpeg fast image converter in Odin

A simple tool that works even with image files of big dimensions.

Description

This is a simple image converter from .ppm to .jpeg, and can work with files of several Gigabytes. It also is a very small lib that allows you to easilly save a .ppm file in the P6 binary format. The lib also works for big files. This lib uses the stb include image files bindings that have to be compiled with the make on the Odin slash vendors slash stb slash src .

ppm2jpeg usage

Usage : ppm2jpeg -q <quality> <input.ppm> <output.jpeg>

      -q <quality>    JPEG quality ( 1 - 100, default: 90 )
      <input.ppm>     Input PPM image file
      <output.jpeg>   Output JPEG image file

The lib function

// Save .ppm image to file in P6 - binary mode ( not compressed )
save_ppm_to_file :: proc ( output_file_name : string,
                           buffer           : [ ]u8,     // 3 Channels R G B
                           width            : int,
                           height           : int  ) ->
                         ( ok : bool )

License

MIT Open Source License

Have fun

Best regards,
Joao Carvalho