Exemplo n.º 1
0
 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";
     }
 }
Exemplo n.º 2
0
 public BuildEndpoint EncodeToStream(Stream stream, bool disposeStream, IEncoderPreset encoderPreset) =>
 Encode(new StreamDestination(stream, disposeStream), encoderPreset);
Exemplo n.º 3
0
 public BuildEndpoint EncodeToBytes(IEncoderPreset encoderPreset) =>
 Encode(new BytesDestination(), encoderPreset);
Exemplo n.º 4
0
 public BuildEndpoint Encode(IOutputDestination destination, IEncoderPreset encoderPreset) =>
 Encode(destination, Builder.GenerateIoId(), encoderPreset);
Exemplo n.º 5
0
 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));
 }