Clase FileCreateSource
Contenido
[
Ocultar
]Summary: Represents a file source for creation.
Module: aspose.imaging.sources
Full Name: aspose.imaging.sources.FileCreateSource
Inheritance: FileSource
Constructors
| Name | Descripción |
|---|---|
| FileCreateSource(file_path) | Inicializa una nueva instancia de la clase FileCreateSource. |
| FileCreateSource(file_path, is_temporal) | Inicializa una nueva instancia de la clase FileCreateSource. |
Properties
| Name | Type | Access | Descripción |
|---|---|---|---|
| file_path | string | r | Obtiene la ruta del archivo a crear. |
| is_temporal | bool | r | Obtiene un valor que indica si el archivo será temporal. |
Methods
| Name | Descripción |
|---|---|
| get_stream_container() | Obtiene el contenedor de flujo. |
Constructor: FileCreateSource(file_path)
FileCreateSource(file_path)
Inicializa una nueva instancia de la clase FileCreateSource.
Parameters:
| Parámetro | Tipo | Descripción |
|---|---|---|
| file_path | string | La ruta del archivo a crear. |
See also:
Example # 1: This example creates a new Image file at some disk location as specified by `…
Constructor: FileCreateSource(file_path, is_temporal)
FileCreateSource(file_path, is_temporal)
Inicializa una nueva instancia de la clase FileCreateSource.
Parameters:
| Parámetro | Tipo | Descripción |
|---|---|---|
| file_path | string | La ruta del archivo a crear. |
| is_temporal | bool | Si se establece en |
See also:
Example # 1: This example creates a new Image file at some disk location as specified by S…
Method: get_stream_container()
get_stream_container()
Obtiene el contenedor de flujo.
Returns
| Tipo | Descripción |
|---|---|
| StreamContainer | el contenedor de flujo. |
Examples
This example creates a new Image file at some disk location as specified by source property of the BmpOptions instance. If second parameter is not passed to the constructor of FileCreateSource, then by default the file to be created has property is_temporal set to True. With is_temporal set to True, no file will be saved on disk at the end of execution.
from aspose.imaging import Image
from aspose.imaging.imageoptions import BmpOptions
from aspose.imaging.sources import FileCreateSource
#Crea una instancia de BmpOptions y establece sus diversas propiedades
with BmpOptions() as bmp_options:
bmp_options.bits_per_pixel = 24
#Crea una instancia de `FileCreateSource` y asígnala como `source` para la instancia de `BmpOptions`
#Si no se pasa el segundo parámetro, entonces por defecto el archivo tiene `is_temporal` establecido en True
bmp_options.source = FileCreateSource(r"C:\temp\output.bmp")
#Crea una instancia de Image
with Image.create(bmp_options, 500, 500) as image:
#realiza algún procesamiento de imagen
image.save()
This example creates a new Image file at some disk location as specified by Source property of the BmpOptions instance. Several properties for BmpOptions instance are set before creating the actual image. Especially the Source property, that refers to the actual disk location in this case.
from aspose.imaging import Image
from aspose.imaging.imageoptions import BmpOptions
from aspose.imaging.sources import FileCreateSource
#Crea una instancia de `BmpOptions` y establece sus diversas propiedades
with BmpOptions() as bmp_options:
bmp_options.bits_per_pixel = 24
#Crea una instancia de `FileCreateSource` y asígnala como `source` para la instancia de `BmpOptions`
#El segundo parámetro `Boolean` determina si el archivo a crear es_temporal o no
bmp_options.source = FileCreateSource(r"C:\temp\output.bmp", False)
#Crea una instancia de Image e inicialízala con una instancia de BmpOptions llamando al método Create
with Image.create(bmp_options, 500, 500) as image:
#realiza algún procesamiento de imagen
# guarda todos los cambios
image.save()