how can I convert image to int() array? found to byte(), but not to int
I want to get black-white int() from image. image should be first converted to base64.
this is java example....pixel by pixel
canvas.toDataURL('image/jpeg').replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
thx
I want to get black-white int() from image. image should be first converted to base64.
this is java example....pixel by pixel
canvas.toDataURL('image/jpeg').replace(/^data:image\/(png|jpg|jpeg);base64,/, "");
Java:
private static void convertARGBToGrayscale(int[] argb, int width, int height) {
int pixels = width * height;
for(int i = 0; i < pixels; ++i) {
int r = argb[i] >> 16 & 255;
int g = argb[i] >> 8 & 255;
int b = argb[i] & 255;
int color = r * 19 + g * 38 + b * 7 >> 6 & 255;
argb[i] = color;
}
}