private static void GetEncoder(Imageflow.Bindings.ImageInfo info, out IEncoderPreset encoder, out string expectedExt) { if (string.Equals("image/png", info.PreferredMimeType, StringComparison.OrdinalIgnoreCase)) { encoder = new PngQuantEncoder(100, 80); expectedExt = ".png"; } else { encoder = new MozJpegEncoder(80, true); expectedExt = ".jpg"; } }
public BuildEndpoint EncodeToStream(Stream stream, bool disposeStream, IEncoderPreset encoderPreset) => Encode(new StreamDestination(stream, disposeStream), encoderPreset);
public BuildEndpoint EncodeToBytes(IEncoderPreset encoderPreset) => Encode(new BytesDestination(), encoderPreset);
public BuildEndpoint Encode(IOutputDestination destination, IEncoderPreset encoderPreset) => Encode(destination, Builder.GenerateIoId(), encoderPreset);
public BuildEndpoint Encode(IOutputDestination destination, int ioId, IEncoderPreset encoderPreset) { Builder.AddOutput(ioId, destination); return(new BuildEndpoint(Builder, new { encode = new { io_id = ioId, preset = encoderPreset?.ToImageflowDynamic() } }, this, null)); }