Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

296
Views
How to resize an image keeping aspect ratio with cropperjs

I'm trying to resize an image to a predefined size, keeping the aspect ratio of it. I've been using the following code to get the image data, but I don't know how to resize.

cropper.getCroppedCanvas().toDataURL('image/jpeg');
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can potentially use

cropper.getCroppedCanvas({ width: DESIRED_WIDTH, height: DESIRED_HEIGHT}).toDataURL(ORIGINAL_MIME_TYPE);

Its important to specify the original mime type of the image (png/gif etc) because otherwise you may end up with a significantly bigger image size in terms of file size.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!