Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byte[] bs = { (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x00, (byte) 0x00,
- (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x10, (byte) 0x00, (byte) 0x01,
- (byte) 0x10, (byte) 0x00, (byte) 0x01, (byte) 0x11, (byte) 0x11, (byte) 0x00, (byte) 0x22,
- (byte) 0x01, (byte) 0x10, (byte) 0x33, (byte) 0x00, (byte) 0x11, (byte) 0x10, (byte) 0x02,
- (byte) 0x22, (byte) 0x01, (byte) 0x10, (byte) 0x33, (byte) 0x30, (byte) 0x01, (byte) 0x10,
- (byte) 0x22, (byte) 0x22, (byte) 0x01, (byte) 0x10, (byte) 0x33, (byte) 0x33, (byte) 0x01,
- (byte) 0x10, (byte) 0x22, (byte) 0x22, (byte) 0x01, (byte) 0x10, (byte) 0x33, (byte) 0x33,
- (byte) 0x01, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x01, (byte) 0x11, (byte) 0x11, (byte) 0x01, (byte) 0x10,
- (byte) 0x11, (byte) 0x11, (byte) 0x10, (byte) 0x01, (byte) 0x11, (byte) 0x11, (byte) 0x01,
- (byte) 0x10, (byte) 0x11, (byte) 0x11, (byte) 0x10, (byte) 0x00, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10, (byte) 0x44,
- (byte) 0x44, (byte) 0x01, (byte) 0x10, (byte) 0x55, (byte) 0x55, (byte) 0x01, (byte) 0x10,
- (byte) 0x44, (byte) 0x44, (byte) 0x01, (byte) 0x10, (byte) 0x55, (byte) 0x55, (byte) 0x01,
- (byte) 0x10, (byte) 0x04, (byte) 0x44, (byte) 0x01, (byte) 0x10, (byte) 0x55, (byte) 0x50,
- (byte) 0x01, (byte) 0x11, (byte) 0x00, (byte) 0x44, (byte) 0x01, (byte) 0x10, (byte) 0x55,
- (byte) 0x00, (byte) 0x11, (byte) 0x11, (byte) 0x10, (byte) 0x00, (byte) 0x01, (byte) 0x10,
- (byte) 0x00, (byte) 0x01, (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x11, (byte) 0x00,
- (byte) 0x00, (byte) 0x11, (byte) 0x11, (byte) 0x11, };*/
- Color white = display.getSystemColor(SWT.COLOR_WHITE);
- Color black = display.getSystemColor(SWT.COLOR_BLACK);
- Color yellow = display.getSystemColor(SWT.COLOR_YELLOW);
- Color red = display.getSystemColor(SWT.COLOR_RED);
- Color green = display.getSystemColor(SWT.COLOR_GREEN);
- Color blue = display.getSystemColor(SWT.COLOR_BLUE);
- // Create a source ImageData of depth 4
- PaletteData palette = new PaletteData(new RGB[] { black.getRGB(), white.getRGB(),
- yellow.getRGB(), red.getRGB(), blue.getRGB(), green.getRGB() });
- ImageData sourceData = new ImageData(16, 16, 4, palette, 1, b);
- InputStream in = new ByteArrayInputStream(imageDataByteArray);
- BufferedImage bufImg = ImageIO.read(in);
- ImageIcon icon = new ImageIcon(bufImg);
- myButton.setIcon(icon);
- contact.setImage(pCur.getBlob(0));
- publishProgress("befor compress");
- Bitmap image = BitmapFactory.decodeByteArray(contact.getImage(), 0, contact.getImage().length);
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- image.compress(Bitmap.CompressFormat.JPEG, 50, stream); //JPEG or what you want
- contact.setImage(stream.toByteArray());
- stream.close();
Add Comment
Please, Sign In to add comment