question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use the library as an image resizer?

See original GitHub issue

Hello,

I let my users change their profile image via the camera gallery and device. Since the upload is directly done to Azure (without transiting by our servers) I need to resize images on the client side.

According to the docs, the Downsampling properties are resizing the image to consume less memory. And since there is a GetImageAsJpgAsync(), I thought that I could use a non-displayed CachedImage to resize the camera image :

var downsampledImage = new CachedImage {
    Source = ImageSource.FromStream(() => media.GetStream()),
    DownsampleHeight = 128
};

var jpgBytes = await downsampledImage.GetImageAsJpgAsync(); // exception occurs here

await blockBlob.UploadFromByteArrayAsync(jpgBytes, 0, jpgBytes.Length);

But I get a not-so-helpful NullReferenceException on the GetImageAsJpgAsync line. I think the error comes from the library? Am I using it bad?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
daniel-luberdacommented, Mar 17, 2016

Yes, it has to be rendered. Other operations are better suited for other dedicated libraries like https://github.com/JimBobSquarePants/ImageProcessor and others

0reactions
SarathVeecommented, Aug 9, 2017

I’m developing Xamarin mobile application so for i need capture image and performing Auto edge detection on Image also giving image enhancement like Lightning the Cropped image,any help to complete it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Which free image resizing library can I use for ...
I have used Umbraco and there is very nice ImageGen library there which allows to resize images 'on the fly' and cashes processed...
Read more >
Best JavaScript Image Resize Libraries (2022)
Pica is an in-browser image resizing tool that lets you resize a Canvas element, Image element, or Image Bitmap. It outputs the resized...
Read more >
How Can I Resize an Image Using Java?
Thumbnailator is an open-source image resizing library for Java that uses progressive bilinear scaling. It supports JPG, BMP, JPEG, WBMP, ...
Read more >
Image Resizing in Python | Pillow, Open CV and ImageKit
Here's a technical guide for resizing images in python. Learn to use Pillow, OpenCV, and ImageKit. Check out ImageKit's advantages.
Read more >
Python Image Resize With Pillow and OpenCV
Resize Images in Python With OpenCV · Import the OpenCV library: import cv2; import matplotlib.pyplot as plt · Acquire a sample image and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found