Friday 27 September 2013

IMAGE COMPRESSION in C Aglorithm | Computer Graphics Lab Manual | IT department | Final Year



AIM:

To perform image compression in Java.

ALGORITHM:

1. Start the program.

2. Read the image file and compress it.

3. Check the length of both files.

4. Print file size before and after compression.

5. Stop the program.



SOURCE CODE:

import java.io.*;

import java.util.zip.*;

class dzip

{

public static void main(String args[]) throws Exception

{

FileInputStream fin=new FileInputStream("i1.bmp");

DeflaterOutputStream dout=new DeflaterOutputStream(new FileOutputStream("i1.zip"));

int b;

while((b=fin.read())!=-1)

dout.write(b);

fin.close();

dout.close();

File f1=new File("i1.bmp");

File f2=new File("i1.zip");

System.out.println("Before :"+f1.length());

System.out.println("After :"+f2.length());

}



}

No comments:

Don't You Think this Awesome Post should be shared ??
| IMAGE COMPRESSION in C Aglorithm | Computer Graphics Lab Manual | IT department | Final Year |
Back To Top Related Posts Plugin for WordPress, Blogger...