Skip to content

yushulx/NV21-to-RGB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NV21 to RGB in Java

What's included?

  • A custom BMP Class.
  • Methods of converting NV21 to RGB.

Sample

File file = new File("2048x1536.yuv"); // The input NV21 file
		if (!file.exists())
			return;

		// BMP file info
		int width = 2048, height = 1536;
		short pixelBits = 32;

		try {
			// Read all bytes
			byte[] bytes = Files.readAllBytes(file.toPath());

			int[] data = NV21.yuv2rgb(bytes, width, height);
			BMP bmp = new BMP(width, height, pixelBits, data);
			bmp.saveBMP("nv21.bmp"); // The output BMP file

		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

		System.out.println("Conversion is done.");

Reference

Blog

How to Convert NV21 Data to BMP File in Java

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages