简体   繁体   English

调整Java图像大小(3种尺寸)的每个图像均上传到Amazon S3

[英]Java Image resizing (3 sizes) upload each to Amazon S3

I'm using grails with jetS3t to upload an image to S3, this works fine. 我将grails与jetS3t一起使用将图像上传到S3,效果很好。

But now I need to re-size the image (thumbnail, small and medium) and upload them all to S3. 但是现在我需要调整图像大小(缩略图,中小尺寸)并将其全部上传到S3。

So far I'm thinking about using ImageMagick, But don't know which is the best way to approach the resizing. 到目前为止,我正在考虑使用ImageMagick,但不知道哪种方法是调整大小的最佳方法。

Should I: 我是不是该:

Upload original to S3, then re-size using the URL received from S3(another download), and upload the re-sized image to S3, (x3) 将原件上传到S3,然后使用从S3接收的URL调整大小(另一次下载),然后将调整大小后的图像上传到S3,(x3)

OR 要么

Upload and use image bytes in memory, do all the resizing, upload the 3 re-sized photos and the original to S3 上传并使用内存中的图像字节,进行所有调整大小,将3张重新调整尺寸的照片和原始图像上传到S3

Depends on your quality requirements and memory availability. 取决于您的质量要求和内存可用性。

If you want the resized images to be good quality then using ImageMagick is probably a good option but that requires the source image to be saved locally on disk. 如果您希望调整大小后的图像具有良好的质量,则使用ImageMagick可能是一个不错的选择,但这需要将源图像保存在本地磁盘上。 On the other hand, you won't need to store all images in memory. 另一方面,您不需要将所有图像存储在内存中。 Im4Java worked very well for me as an interface to IM. Im4Java作为IM的接口对我来说非常有效。

Using the Java Graphics package and BufferedImage class you can do an in-memory operation but this might not produce as good quality images. 使用Java Graphics包和BufferedImage类,您可以执行内存中操作,但这可能无法生成质量好的图像。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM