Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On resizing watermark logo we are getting "Parameter is not valid." Exception #20

Open
singhdiksha2609 opened this issue Jun 26, 2023 · 1 comment

Comments

@singhdiksha2609
Copy link

singhdiksha2609 commented Jun 26, 2023

We are downloading watermark logo from wasabi server and resizing before applying watermark on image on time of resizing we are getting "Parameter is not valid. " exception

please suggest me best option to overcome this

code snippet we are using

string watermarkPath = tenantsetting.Cdnwasabipicturebaseurl + tenantsetting.Wasabibucketname + 
   "/" + _settingService.GetSettingsByName("WatermarkLogoPath").Value + 
   "/" + user.Opicxo_CustomerId + 
   "/" + watermark.Logo;

   var watermarkwebRequest = (HttpWebRequest)HttpWebRequest.Create(watermarkPath);
   var watermarkresponse = watermarkwebRequest.GetResponse();
   var watermarkcontent = watermarkresponse.GetResponseStream();
   watermarkcontent.CopyTo(watermarkstream);
   watermarkImage = Image.FromStream(watermarkstream);

   watermarkImage.Save(watermarkstream, ImageFormat.Png);
   var relativeSize = watermark.FontSize * 40 / 100;
   var resizewidth = bitmap.Width * relativeSize / 100;

   watermarkImage.ScaleByWidth(resizewidth).SaveAs(newImagelogo);

log we are getting
https://prnt.sc/f-CHOGbhTm3K

If any other method is there to resize then also suggest

@LazZiya
Copy link
Owner

LazZiya commented Jun 26, 2023

I can suggest below steps:

  • make sure that the path and request are getting an image stream correctly.
  • comment out this line:
    // watermarkImage.Save(watermarkstream, ImageFormat.Png);
  • try with image file in local server

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants