Get the App
SLTechnology News&Howtos  ›  Development  › 

How to reduce the picture proportionally by Java

Shulou Source: shulou.com Published: 2022-05-31 20:15:10 10月03日 Update

This article mainly explains "Java how to achieve proportional reduction of the picture", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Java how to achieve proportional reduction of the picture" bar!

Upload a file @ RequestParam (value= ", required=true) using the spring annotation. You cannot pass a null value when required is true, and vice versa; UploadFile.getOriginalFilename () gets the file name of the uploaded file; System.nanoTime () returns the nanosecond of the current time, which is used as the file name; FileUtils.writeByteArrayToFile () uploads the file to the local directory; uses BufferedImage to load the image into memory, and then modifies the image, such as resizing, graying, setting transparency, and so on.

Effect picture:

HTML:

* avatar:

Upload pictures

Tags: Picture file scale name study content file name memory original image size avatar that is ideas situations effects effects articles time more notes Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn OPPO Reno macOS Redmi Shulou Tech Info