मैंने थोड़ी सी खोज की है लेकिन इसकी स्पष्ट झलक नहीं मिल सकती है। मैं एक छवि के बाइट सरणी को एक छविदृश्य में कैसे सेट कर सकता हूं? मुझे स्ट्रिंग मिली है BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes));
जावा में, लेकिन यह करने में सक्षम नहीं है :(क्या कोई मेरी मदद कर सकता है? क्षमा करें अगर सवाल नोब की तरह था :)छवि दृश्य में छवि का बाइट सरणी
22
A
उत्तर
52
बिटमैप को बाइटमैप में बदलने और बिटमैप को बाईटियर करने के लिए कोड नीचे आज़माएं, यह हल हो जाएगा तुम्हारी समस्या। Bytearray को
Convert बिटमैप: - बिटमैप को
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
Convert bytearray: -
Bitmap bmp = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length);
ImageView image = (ImageView) findViewById(R.id.imageView1);
image.setImageBitmap(Bitmap.createScaledBitmap(bmp, image.getWidth(),
image.getHeight(), false)));
-1
बिटमैप से बाइट्स हो जाओ
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 70, stream);
byte[] bytearray = stream.toByteArray();
return bytearray;
+0
यह गलत जवाब है जो आप देते हैं। –
thanx दोस्त, की जाँच करेगा और आप टेलीफोन –
सही पैसे पर :) thanx बहुत –
इस के साथ कोई OutOfMemoryError हो सकता है? –