Difference between revisions of "ImageData:encode"

m
m
Line 8: Line 8:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|ImageFormat|format|The format to encode the image as.}}
+
{{param|ImageEncodeFormat|format|The format to encode the image as.}}
 
{{param|string|filename (nil)|The filename to write the file to. If nil, no file will be written but the FileData will still be returned.}}
 
{{param|string|filename (nil)|The filename to write the file to. If nil, no file will be written but the FileData will still be returned.}}
 
=== Returns ===
 
=== Returns ===
Line 32: Line 32:
 
=== Arguments ===
 
=== Arguments ===
 
{{param|string|outFile|Name of a file to write encoded data to.}}
 
{{param|string|outFile|Name of a file to write encoded data to.}}
{{param|ImageFormat|format|The format to encode the image in.}}
+
{{param|ImageEncodeFormat|format|The format to encode the image in.}}
 
=== Returns ===
 
=== Returns ===
 
Nothing.
 
Nothing.
Line 43: Line 43:
 
</source>
 
</source>
 
=== Arguments ===
 
=== Arguments ===
{{param|ImageFormat|format|The format to encode the image in.}}
+
{{param|ImageEncodeFormat|format|The format to encode the image in.}}
 
=== Returns ===
 
=== Returns ===
 
{{param|Data|data|The encoded image data.}}
 
{{param|Data|data|The encoded image data.}}

Revision as of 23:00, 12 February 2020

Encodes the ImageData and optionally writes it to the save directory.

Function

Available since LÖVE 0.10.0
This variant is not supported in earlier versions.

Synopsis

filedata = ImageData:encode( format, filename )

Arguments

ImageEncodeFormat format
The format to encode the image as.
string filename (nil)
The filename to write the file to. If nil, no file will be written but the FileData will still be returned.

Returns

FileData filedata
The encoded image as a new FileData object.

Function

Available since LÖVE 0.8.0 and removed in LÖVE 0.10.0
This variant is not supported in earlier or later versions.

Synopsis

ImageData:encode( outFile )

Arguments

string outFile
Name of a file to write encoded data to. The format will be automatically deduced from the file extension.

Returns

Nothing.

Function

Available since LÖVE 0.8.0 and removed in LÖVE 0.10.0
This variant is not supported in earlier or later versions.

Synopsis

ImageData:encode( outFile, format )

Arguments

string outFile
Name of a file to write encoded data to.
ImageEncodeFormat format
The format to encode the image in.

Returns

Nothing.

Function

Removed in LÖVE 0.8.0
This variant is not supported in that and later versions.

Synopsis

data = ImageData:encode( format )

Arguments

ImageEncodeFormat format
The format to encode the image in.

Returns

Data data
The encoded image data.

See Also


User Notes

  • If you want the file to have an extension when saved add it in the file name. Example :
    image:encode("png","aPngImage.png")
    

Other Languages