Posts Under 'Resize'

Basic JPEG image resizing in Java

/* JpegResizerDemo.java */ import java.io.FileInputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.awt.image.RescaleOp; import java.awt.image.AffineTransformOp; import java.awt.geom.AffineTransform; import java.util.Map; import java.util.HashMap; import com.sun.image.codec.jpeg.JPEGImageDecoder; import com.sun.image.codec.jpeg.JPEGCodec; import com.sun.image.codec.jpeg.ImageFormatException; import com.sun.image.codec.jpeg.JPEGImageEncoder; /** * @author CyranoVR */ public class ImageResizer { public static void main(String args[]) { if (args.length != 3) { […]

Read more »


Image resizing with PHP

<?php function imageResize($width, $height, $target) { //takes the larger size of the width and height and applies the formula accordingly…this is so this script will work dynamically with any size image if ($width > $height) { $percentage = ($target / $width); } else { $percentage = ($target / $height); } //gets the new value and […]

Read more »