Clase FileCreateSource

Summary: Represents a file source for creation.

Module: aspose.imaging.sources

Full Name: aspose.imaging.sources.FileCreateSource

Inheritance: FileSource

Constructors

NameDescripció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

NameTypeAccessDescripción
file_pathstringrObtiene la ruta del archivo a crear.
is_temporalboolrObtiene un valor que indica si el archivo será temporal.

Methods

NameDescripció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ámetroTipoDescripción
file_pathstringLa 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ámetroTipoDescripción
file_pathstringLa ruta del archivo a crear.
is_temporalboolSi se establece en true el archivo creado será temporal.

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

TipoDescripción
StreamContainerel 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()