Hi there,

When I tried to run the below-mentioned code scenario, the JVM kicked me out with an error
That's why, I give two VM parameters
-Xms256m -Xmx256m to increase Heap size.
It was working just only on superficial stage, the result
output image size is only 2.xxMB significantly differs from original one(original image is 7.xxMB). The image quality is not aggreesable.
How could I fix it?

import javax.imageio.*;
import javax.imageio.stream.ImageOutputStream;

import java.io.*;
import java.awt.image.BufferedImage;
import java.util.Iterator;

public class ImageReading {
public ImageReading() {
public static void main(String[] args) {
ImageReading imageReading1 = new ImageReading();


File f = new File("D:\\space2.jpg");
BufferedImage bi = ImageIO.read(f);

File f1 = new File("D:\\space.jpg");

Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
ImageWriter writer = (ImageWriter)writers.next();

ImageOutputStream ios = ImageIO. createImageOutputStream(f1);

} catch (Exception e ) {

(A Java Developer)