0

When I export image as in GIMP it asks wheather to save in ASCII format or in RAW format, what's the difference? size of ASCII is much higher than raw format for same image (3 times higher), why so?

I want to see how each pixel values are stored in the image, how can I do this ? is there any direct GUI tool for this which does not make me write any code for this?

How to convert a PBM image to C image array something like one given below. to elaborate my last question : how to fetch output.h(which contains array of pixel information of the image) file from a pbm file.

#include <stdint.h>

    static const struct
    {
        uint16_t width;
        uint16_t height;
        uint8_t pixel_data[205 * 62 * 2 + 1];
    } file_name = {
        205, 62,
        { 181, 182, 181, 182, 181, 182, 181, 
       ......
       ......
        81, 182, 181, 182, 181, 182, 181, 
}

Really stuck with this problem for a long time now please help if possible.

1 Answers1

0

The difference between ASCII and RAW is:

  • ASCII will save every pixel RGB color channels as text, and
  • RAW will save the RGB values in binary

The RAW format is smaller since it requires less bytes for each pixel instead of the text.

Example: Every color will be stored in 3 bytes (RAW) and at can be up to 9 bytes for ASCII (white color for instance: 255 255 255).

I did not understand your last question, but if you have a PBM file and want to open it in a C/C++ program, you can use the FreeImage library, for instance. This library supports several image formats, including PBM.

André Caceres
  • 719
  • 4
  • 15