Documentation
¶
Overview ¶
Package encode produces base64 data URIs for inline file and image payloads. Encode, EncodeFile, EncodeImage and the ImageFormat values are re-exported from the top-level fal package. ImageFormat lives here (rather than in upload) because both encode.EncodeImage and upload's UploadImage take it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeFile ¶
EncodeFile reads a file and returns a base64 data URI, detecting the content type from the extension. It mirrors fal_client.encode_file.
func EncodeImage ¶
func EncodeImage(img image.Image, format ImageFormat) (string, error)
EncodeImage encodes an image and returns a base64 data URI. It mirrors fal_client.encode_image.
Pass FormatJPEG or FormatPNG for an explicit, self-documenting call. The zero value (empty ImageFormat) defaults to JPEG, matching fal_client.encode_image's format="jpeg" default.
Types ¶
type ImageFormat ¶
type ImageFormat string
ImageFormat selects the wire encoding for an image. The zero value encodes as JPEG, matching the Python client's format="jpeg" default.
const ( FormatJPEG ImageFormat = "jpeg" FormatPNG ImageFormat = "png" )