:orphan:
# PetscDrawSetSaveFinalImage
Saves the final image produced in a `PetscDraw` into a file 
## Synopsis
```
#include "petscdraw.h" 
PetscErrorCode PetscDrawSetSaveFinalImage(PetscDraw draw, const char filename[])
```
Collective


## Input Parameters

- ***draw      -*** the graphics context
- ***filename  -*** name of the file, if NULL or empty uses name set with `PetscDrawSetSave()` or the name of the draw object



## Options Database Key

- ***-draw_save_final_image  <filename> -*** filename could be name.ext or .ext (where .ext determines the type of graphics file to save, for example .png)





## Notes
You should call this BEFORE creating your image and calling `PetscDrawSave()`.

The supported image types are .png, .gif, and .ppm (PETSc chooses the default in that order).
```none
   Support for .png images requires configure --with-libpng.
   Support for .gif images requires configure --with-giflib.
   Support for .jpg images requires configure --with-libjpeg.
   Support for .ppm images is built-in. The PPM format has no compression (640x480 pixels ~ 900 KiB).
```



## See Also
 `PetscDraw`, `PetscDrawSetSave()`, `PetscDrawSetFromOptions()`, `PetscDrawCreate()`, `PetscDrawDestroy()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/interface/dsave.c.html#PetscDrawSetSaveFinalImage">src/sys/classes/draw/interface/dsave.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/draw/interface/dsave.c)


[Index of all Draw routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
