pub enum OutputFormat {
Jpeg,
Gif,
Png,
Webp,
Avif,
Heic,
}Expand description
An output format.
PHP: the $type string of output() and save(); jpg and jpeg are
the same format.
use utopia_image::OutputFormat;
assert_eq!("jpeg".parse::<OutputFormat>()?, OutputFormat::Jpeg);
assert_eq!("bmp".parse::<OutputFormat>().unwrap_err().to_string(), "Unsupported output format: bmp");use Utopia\Image\Image;
$source = new \Imagick();
$source->newImage(2, 2, 'red', 'png');
try {
(new Image($source->getImageBlob()))->output('bmp');
} catch (\Exception $e) {
echo $e->getMessage(), "\n"; // Invalid output type given
}Variants§
Jpeg
jpg or jpeg
Gif
gif, every frame
Png
png, the first frame
Webp
webp, every frame
Avif
avif, the first frame
Heic
heic: refused, as no HEVC encoder is available (see the crate docs)
Trait Implementations§
Source§impl Clone for OutputFormat
impl Clone for OutputFormat
impl Copy for OutputFormat
Source§impl Debug for OutputFormat
impl Debug for OutputFormat
impl Eq for OutputFormat
Source§impl FromStr for OutputFormat
impl FromStr for OutputFormat
Source§impl Hash for OutputFormat
impl Hash for OutputFormat
Source§impl PartialEq for OutputFormat
impl PartialEq for OutputFormat
impl StructuralPartialEq for OutputFormat
Auto Trait Implementations§
impl Forget for OutputFormat
impl Freeze for OutputFormat
impl Move for OutputFormat
impl RefUnwindSafe for OutputFormat
impl Send for OutputFormat
impl Sync for OutputFormat
impl Unpin for OutputFormat
impl UnsafeUnpin for OutputFormat
impl UnwindSafe for OutputFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more