Skip to content

generaloss/stb-image-jni

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image loading/decoding from file/memory: JPG, PNG, TGA, BMP, PSD, GIF, HDR, PIC

Maven Central


stb_image.h version: 2.30


How to use:

  1. Add the stb-image-jni dependency.
  2. Add the natives you need:

Android SDK: 21


Code sample:

Java version: 1.8

StbImage.setFlipVerticallyOnLoad(false);

int[] width = new int[1];
int[] height = new int[1];
int[] channels = new int[1];

ByteBuffer data = StbImage.load("image.png", width, height, channels, 4);
if(data == null)
   throw new RuntimeException("Failed to load image: " + StbImage.failureReason());

// The pixel data consists of ${height} scanlines of ${width} pixels

StbImage.imageFree(data);

Bugs and Feedback

For bugs, questions and discussions please use the GitHub Issues.