Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ${YYAndroidPackageName}; //Import the GM:S stuff
- import ${YYAndroidPackageName}.R;
- import com.yoyogames.runner.RunnerJNILib;
- import android.util.Log;
- import java.io.File;
- import java.io.FileReader;
- import java.io.BufferedReader;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.lang.String;
- import android.graphics.Bitmap;
- import android.graphics.BitmapFactory;
- import java.io.ByteArrayOutputStream;
- public class loadimage {
- public String load_image(String fname) {
- File imgFile = new File(fname);
- String Output = "failed";
- if(imgFile.exists()){
- Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- myBitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
- byte[] byteArray = stream.toByteArray();
- myBitmap.recycle();
- Output = new String(byteArray);
- }
- return Output;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement