Dumb v3.0.0 API Question - I'm probably not reading the docs right #2380
-
So currently using v2 I have this:
This ensures the new/transformed file is generated in the same format as the original - JPEG, PNG whatever. In v3.0.0 the API with the output param for the format seems to be missing (or I can't find it). How do I do this now?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Yeah, we've got a breaking change. The whole You can now find that information in the image metadata DecoderOptions options = new() { TargetSize = new( width: config.MaxImageSize, height: config.MaxImageSize ) };
using var img = await Image.LoadAsync(options, input);
// ... now do some some funky stuff...
await img.SaveAsync(outputStream, image.Metadata.DecodedImageFormat); |
Beta Was this translation helpful? Give feedback.
-
Perfect, thanks. I thought it was somewhere in there, but couldn't spot it. Much cleaner API - good work! |
Beta Was this translation helpful? Give feedback.
Yeah, we've got a breaking change.
The whole
out
API was clunky and wasn't consistant across sync/async so we did a complete overhaul of the Load APIs to simplify things.You can now find that information in the image metadata
https://docs.sixlabors.com/articles/imagesharp/imageformats.html#loading-and-saving-specific-image-formats