Cytosim PI Cytoskeleton Simulator

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Functions
SaveImage Namespace Reference

Can save pixel array to files in (PNG, GIF or PPM) format. More...

## Functions
FILE * | openFile (const char *name)
| open a file for binary write
int | saveColorPPM (FILE *file, const GLubyte pixels[], int width, int height)
| Netpbm pixel image format, 3 bytes per pixels (R, G, B). Returns error-code. More...
int | savePNG (FILE *file, void *pixels, int bit_depth, int nb_colors, int width, int height)
| write PNG image
int | saveAlphaPNG (FILE *file, void *pixels, int width, int height)
| Portable Network Graphic format, 3 bytes per pixels (R, G, B) More...
int | saveColorPNG (FILE *file, void *pixels, int width, int height)
| Portable Network Graphic format, 3 bytes per pixels (R, G, B) More...
int | saveGrayPNG (FILE *file, void *pixels, int width, int height)
| gray-level PNG format with 2 bytes per pixels More...
int | saveColorGIF (FILE *file, const GLubyte pixels[], int width, int height)
| Graphics Interchange Format, 3 bytes per pixels (R, G, B). Returns error-code.
int | savePixels (const char format[], FILE *, GLubyte *pixels, int width, int height)
| save pixels[] and return error-code
int | savePixels (const char format[], const char *name, GLubyte *pixels, int width, int height)
| save pixels[] and return error-code
bool | supported (const char format[])
| true if 'format' is the 3-letter file-entension of a supported image format More...
int | saveImage (const char format[], const char *name, int x, int y, int width, int height)
| save a region of the current buffer. The appropriate file-extension is added to 'name'. Returns error-code More...
int | saveImage (const char format[], unsigned int nb, int x, int y, int width, int height)
| calls saveImage, with a file image????, where ???? is the 4-digit number 'nb'
int | saveMagnifiedImage (const char format[], const char *name, int mag, int width, int height, void(*display)(int, void *), void *arg)
| save an image with higher resolution (better version) More...
int | saveCompositeImage (const char format[], const char *name, int mag, int width, int height, double pixel_size, void(*display)(int, void *), void *arg)
| save an image with higher resolution More...
int | saveTiledImages (const char format[], int mag, int width, int height, void(*display)(int, void *), void *arg)
| save mag^2 images, which can be tiled to get a high-resolution picture
int | saveTiledImagesT (const char format[], int mag, int width, int height, double pixel_size, void(*display)(int, void *), void *arg)
| save mag^2 images, which can be tiled to get a high-resolution picture More...
void | assemblePPMTiles (const char format[], int mag)
| assemble tiles using PPM tools

## Detailed Description

- PPM files do not require any library, and thus writing is supported on any platform. They can be read by various software, in particular the 'pbmplus' toolkit However, they are big and usually not supported by most viewers. Known viewers on Mac OS X: ImageJ, GraphicConverter, ToyViewer.
- GIF files are great for web, a multiple images GIF file can be animated.
- PNG files are more modern GIF, but do not support multi-image files.

GIF support requires 'giflib' and PNG support requires 'libpng'.

Both libraries are available on Mac OSX via macPorts (www.macports.org):

- port install giflib
- port install libpng

## Function Documentation

int saveAlphaPNG | ( | FILE * | file,
|  | void * | pixels,
|  | int | width,
|  | int | height
| ) |  |

Save RGBA image, 4 x 8-bits per pixel

int saveColorPNG | ( | FILE * | file,
|  | void * | pixels,
|  | int | width,
|  | int | height
| ) |  |

Save RGB image, 3 x 8-bits per pixel

int saveColorPPM | ( | FILE * | file,
|  | const GLubyte | pixels[],
|  | int | width,
|  | int | height
| ) |  |

Write the image in the Portable Pixmap format, also Netpbm format (man -k ppm). We use here the 'raw' binary format starting with P6

int saveCompositeImage | ( | const char | format[],
|  | const char * | filename,
|  | int | mag,
|  | int | width,
|  | int | height,
|  | double | pixel_size,
|  | void(*)(int, void *) | display,
|  | void * | arg
| ) |  |

After setting a higher resolution, this will translate the ModelView to produce several images that will be stiched together, into an image with higher resolution. This works even if the image is larger than the maximum OpenGL viewPort, but the result is not always identical as stitching it not perfect.

int saveGrayPNG | ( | FILE * | file,
|  | void * | pixels,
|  | int | width,
|  | int | height
| ) |  |

Save 16-bits gray-level image

int saveImage | ( | const char | format[],
|  | const char * | filename,
|  | int | x,
|  | int | y,
|  | int | width,
|  | int | height
| ) |  |

saveImage(...) will read pixels from the current OpenGL read buffer, and save them in a file with the requested format

int saveMagnifiedImage | ( | const char | format[],
|  | const char * | filename,
|  | int | mag,
|  | int | width,
|  | int | height,
|  | void(*)(int, void *) | display,
|  | void * | arg
| ) |  |

This adjusts the Viewport to produce an image with higher resolution

int saveTiledImagesT | ( | const char | format[],
|  | int | mag,
|  | int | width,
|  | int | height,
|  | double | pixel_size,
|  | void(*)(int, void *) | display,
|  | void * | arg
| ) |  |

This translate the ModelView matrix to produce an image with higher resolution

bool supported | ( | const char | format[] | ) |

Currently 'gif', 'png' and 'ppm' are supported. The extension can equally be lowercase or uppercase.