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

383
Views
Cambiar el tamaño de una imagen a una relación de aspecto 16:9

Estoy tratando de cambiar el tamaño de la imagen cargada a 16:9 . He estado intentando todo el día y esto es lo mejor que he hecho hasta ahora.

 const resizeResult = await manipulateAsync( uploadResult.uri, [ { resize: uploadResult.width > uploadResult.height ? { height: 900 } : { width: 1600 }, }, { crop: { width: 1600, height: 900, originX: uploadResult.width > uploadResult.height ? (uploadResult.height - uploadResult.width) / 2 : (uploadResult.width - uploadResult.height) / 2, originY: 0, }, }, ], { compress: 0.7, format: SaveFormat.JPEG } );

Desafortunadamente, esto cambia el tamaño/recorta la imagen de 1800x1200 a 1350x900 , no a 1600x900 .

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo que solo tienes que calcular y limitar el tamaño de la imagen usando su relación de aspecto.

 const ratio = uploadResult.width / uploadResult.height; let newWidth = ratio * 900; let newHeight = 900; if (ratio > 0) { newWidth = 1600; newHeight = 1600 / ratio; } const resizeResult = await manipulateAsync( uploadResult.uri, [ { resize: { height: newHeight, width: newWidth } } ], { compress: 0.7, format: SaveFormat.JPEG } );
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!