Split a picture picture into four pieces

Source: Internet
Author: User

Effect of the title:

Split a picture into four pieces, because the picture coding problem, split after only see the effect of the first

Package com.hcj.july21.am;
Import Java.io.File;
Import Java.io.FileInputStream;
Import java.io.FileNotFoundException;

Import Java.io.FileOutputStream; 
		public class Testhe {public static void main (string[] args) throws Exception {file F1 = new File ("images/copy1.jpg");
		File F2 = new file ("Images/copy2.jpg");
		File F3 = new file ("Images/copy3.jpg");
		File F4 = new file ("Images/copy4.jpg");
		
		File out = new file ("Images2/treasuremap.jpg");
		FileInputStream fis1 = new FileInputStream (F1);
		FileInputStream Fis2 = new FileInputStream (F2);
		FileInputStream fis3 = new FileInputStream (F3);
		
		FileInputStream fis4 = new FileInputStream (f4);
		
		FileOutputStream fos = new FileOutputStream (out);
		
		byte[] buffer = new byte[60592 + 1000];
		int read1 = fis1.read (buffer);
		
		Fos.write (buffer, 0, read1);
		int read2 = fis2.read (buffer);
		
		Fos.write (buffer, 0, read2);
		int read3 = fis3.read (buffer);
		
		Fos.write (buffer, 0, READ3);
		int read4 = fis4.read (buffer); Fos.wrITE (buffer, 0, READ4);
		Fos.close ();
		Fis4.close ();
		Fis3.close ();
		Fis2.close ();
		Fis1.close ();
	System.out.println ("End");
 }
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.