Skip to content

In .net6, an exception occurs when converting to other formats #29

@dodu2014

Description

@dodu2014

image

How to solve this problem?

  [ApiController]
  public class PsdController : BaseController
  {
    public PsdController(IWebHostEnvironment env) : base(env) {
    }

    [HttpGet("export")]
    public IActionResult Export() {

      var dir = env.WebRootPath;
      using var ms = new MemoryStream();
      using var pfile = Aspose.PSD.Image.Load(dir + "/images/MerchantQrcodeBoard.psd");

      // save result in different raster formats with customized attributes
      pfile.Save(dir + "/images/output.png", new Aspose.PSD.ImageOptions.PngOptions());
      pfile.Save(dir + "/images/output.jpg", new Aspose.PSD.ImageOptions.JpegOptions() { Quality = 70 });
      pfile.Save(dir + "/images/output.tiff", new Aspose.PSD.ImageOptions.TiffOptions(Aspose.PSD.FileFormats.Tiff.Enums.TiffExpectedFormat.TiffCcitRle));

      pfile.Save(ms, new Aspose.PSD.ImageOptions.PngOptions());

      return File(ms.ToArray(), "image/png");
    }

  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions