ImagenImageFormat
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
public struct ImagenImageFormat
An image format for images generated by Imagen.
To specify an image format for generated images, set imageFormat
in
your ImagenGenerationConfig
. See the Cloud
documentation
for more details.
-
PNG image format.
Portable Network Graphic (PNG) is a lossless image format, meaning no image data is lost during compression. Images in PNG format are typically larger than JPEG images, though this depends on the image content and JPEG compression quality.
Declaration
Swift
public static func png() -> ImagenImageFormat
-
JPEG image format.
Joint Photographic Experts Group (JPEG) is a lossy compression format, meaning some image data is discarded during compression. Images in JPEG format are typically larger than PNG images, though this depends on the image content and JPEG compression quality.
Declaration
Swift
public static func jpeg(compressionQuality: Int? = nil) -> ImagenImageFormat
Parameters
compressionQuality
The JPEG quality setting from 0 to 100, where
0
is highest level of compression (lowest image quality, smallest file size) and100
is the lowest level of compression (highest image quality, largest file size); defaults to75
.