그림을 바이트로 변환하고 Java를 사용하여 이미지 너비와 높이를 얻는 방법



모든 그림을 바이트 형식으로 변환하는 것입니다. jpg 또는 png 형식을 바이트 형식으로 변환하고 Java를 사용하여 필요한 경우 데이터베이스에 저장할 수 있습니다. 이 스크립트는 실제 이미지 너비와 높이와 같은 이미지 속성을 픽셀 단위로 제공합니다. Yuu는 "width x height"형식의 그림 속성을 문자열 형식으로 가져올 수 있습니다.

그림을 바이트로 변환하고, Java를 사용하여 이미지 너비 및 높이 가져 오기

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

import javax.imageio.ImageIO; import org.apache.commons.io.IOUtils; import java.awt.image.BufferedImage; import java.io.File; import java.io.FileInputStream; public class ImageUtil { public static String imageWH() { File imageFile = new File ("C:\test50.png"); FileInputStream fisLocal = new FileInputStream(imageFile); byte[] imageByteLocal = IOUtils.toByteArray(fisLocal); //converting file format FileInputStream fis = new FileInputStream(imageFile); //Get Image height and width BufferedImage bimg = ImageIO.read(fis); int width = bimg.getWidth(); int height = bimg.getHeight(); return (width + "x" + height); } }

이전 기사

Microsoft Surface Pro 3 대 Apple iPad Air 대 Dell Venue Pro 8

Microsoft Surface Pro 3 대 Apple iPad Air 대 Dell Venue Pro 8

Microsoft는 2014 년 5 월 20 일 개최되는 행사에서 Surface 3 Pro라는 최신 표면 장치 장치를 공개했습니다. Microsoft는이 장치가 랩탑을 대체 할 수있는 게임 체인저가 될 것이라고 주장하고 있습니다. 새로운 Surface Pro 3는 뛰어난 디자인 품질과 더 나은 디자인의 터치 및 유형 커버 및 표면 펜과 함께 프리미엄 장치로 사용할 수 있습니다. 터치 및 유형 커버의 사용은이 소형 폼 팩터가있는 노트북처럼 똑같이 생산적인 강력한 노트북과 비슷합니다. Microsoft는 새로운 Surface 3 Pro를 Apple iPad Air 및 iOS 에코 시스템의 경쟁자로 목표로 삼고 있습니다. 이 장치들 사이의 사양 비교는 저렴한 Windows Vista 8.1 Ven Venue 8 Pro와 함께 볼 수 있습니다. Microsoft Surfa...

다음 기사

Mini Enforcer : 은밀한 자기 추적기로 차량 추적

Mini Enforcer : 은밀한 자기 추적기로 차량 추적

페이스 북 지저귀다 Pinterest WhatsApp 전보 우리는 여행 할 때 종종 자신의 안전 조치를 고려하지만, 사람들은 흔히 자동차에 대한 견고한 GPS 추적 장치의 필요성을 간과합니다. 차에 GPS 트래커를 설치하지 않았다면 시간이 걸릴 것입니다. 자녀가 자전거를 탈 때 헬멧을 착용하는 것만 큼 중요합니다. Mini Enforcer는 다양한 제조업체 및 모델에서 사용할 수있는 자동차 용 은밀한 미니 자기 식 GPS 추적기의 훌륭한 예입니다. 여기에서는 자동차에서 사용할 수있는 Mini Enforcer 자석 추적기에 대해 살펴 봅니다. 미니 ...