کار با عکس

سلام . دوستان من نیاز به تغییر سایز عکس به 200 *200 دارم . آیا کلایی مرتبط با این موضوع هست ؟ اگه هست لطفا طرز کار باهاشم بگید و متدهاشو توضیح بدید

پاسخ ها

sokanacademy forum
کاربر سکان آکادمی 8 سال پیش

سلام،زبان جاوا یک زبان سطح بالا است،قاعدتا متد های خوبی داره:

/** * scale image * * @param sbi image to scale * @param imageType type of image * @param dWidth width of destination image * @param dHeight height of destination image * @param fWidth x-factor for transformation / scaling * @param fHeight y-factor for transformation / scaling * @return scaled image */ public static BufferedImage scale(BufferedImage sbi, int imageType, int dWidth, int dHeight, double fWidth, double fHeight) { BufferedImage dbi = null; if(sbi != null) { dbi = new BufferedImage(dWidth, dHeight, imageType); Graphics2D g = dbi.createGraphics(); AffineTransform at = AffineTransform.getScaleInstance(fWidth, fHeight); g.drawRenderedImage(sbi, at); } return dbi; }

برای اطلاع بیشتر http://stackoverflow.com/questions/15558202/how-to-resize-image-in-java

online-support-icon