Schlechte Bildqualität der Kamera

C

computer_freak

Fortgeschrittenes Mitglied
7
Hey,

habe folgendes Problem: Die Bilder, die die Kamera macht sind an sich super,
nur leider werden die bilder irgendwo herunterskaliert.

Am besten etwas code!
Code:
    public void captureImg(View v)
    {
	Intent camIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
	startActivityForResult(camIntent, ACTIVITY_RESULT_CAMERA);	
    }   
    
    
    protected void onActivityResult(int requestCode, int resultCode, Intent data)
    {
	if(requestCode == ACTIVITY_RESULT_CAMERA)
	{
// Ab hier müsste die bildqualität gesunken sein
// In der Kamera activity wird das bild nämlich noch sehr schön angezeigt.
	    Bitmap img = (Bitmap) data.getExtras().get("data");
	    
	    ImageView iv_Img = (ImageView) findViewById(R.id.iv_img);
	    iv_Img.setImageBitmap(img); // Hier wird das bild sehr sehr klein, fast unerkennbar angezeigt
	    
	    String path = Environment.getExternalStorageDirectory().toString();

	    File file = new File(path, "Android/data/blub.png");
	    OutputStream fOut;
	    
	    try
	    {
		fOut = new FileOutputStream(file);
		img.compress(Bitmap.CompressFormat.PNG, 100, fOut);
		fOut.close();
	    } catch (FileNotFoundException e) {} catch (IOException e){}
	    
	}
    }
 
You want to get the images back from the nifty camera you displayed, and here's how:
If you want to get the image back in its full glory, pass in a uri to the Intent within the EXTRA_OUTPUT extra. If you're fine with a smallish bitmap (and you should be), just call the intent as normal.
Now you have two options, deal with the uri of the image that is returned in the EXTRA_OUTPUT extra, or do the following in your onActivityResult method:

java - Using the camera activity in Android. - Stack Overflow
 
Okay,
danke für deine Antwort.

Ich habe nun etwa:
Code:
	camIntent.putExtra("output", "new.png");
	startActivityForResult(camIntent, ACTIVITY_RESULT_CAMERA);


"output" ist das synonym für EXTRA_OUTPUT (Das Makro wird nicht gefunden)
Unsicher bin ich, was ich beim 2. Parameter angeben soll.
pass in a uri to the Intent
Eine Uri zum Intent? Wie mache ich denn so etwas? :D

Abfangen tu ich die Bitmap dann über
Code:
		img = (Bitmap) data.getExtras().get("output");

-> was zum aktuellen Standpunkt logischerweise
Code:
null
liefert


EDIT: habe noch was gefunden!
Ich habe folgendes probiert:

camIntent.putExtra("output", camIntent.toUri(camIntent.URI_INTENT_SCHEME));
camIntent.putExtra("output", camIntent.toURI());
camIntent.putExtra("output", camIntent.toString());

Leider lieferte "output" immer "null" zurück :/.

Hat jemand eine Idee wie man an das high-resolution bild kommt?
 
Zuletzt bearbeitet:

Ähnliche Themen

M
Antworten
3
Aufrufe
167
moin
M
R
  • roadunner88
Antworten
1
Aufrufe
1.284
swa00
swa00
M
Antworten
2
Aufrufe
630
Mozart40
M
Zurück
Oben Unten