Re: [android-developers] JPG corrupted after save and load from external storage

2012-08-13 Thread Harri Smått
On Aug 13, 2012, at 8:05 PM, user123 wrote: > Maybe it's important, this is the code I instantiate the downloaded > bitmap/drawable (which is later saved to the sd card) with: > > InputStream is = fetch(urlString); > TypedValue typedValue = new TypedValue();

Re: [android-developers] JPG corrupted after save and load from external storage

2012-08-13 Thread Harri Smått
On Aug 13, 2012, at 8:05 PM, user123 wrote: > What do you mean exactly with original? I'm downloading it from the web, the > image in the web has jpg extension. Having .jpg extension does not guarantee it's a JPG image (image format is decoded from image header). But as said this is a long sh

Re: [android-developers] JPG corrupted after save and load from external storage

2012-08-13 Thread user123
Oh, and the fetch method looks like this: private InputStream fetch(String urlString) throws MalformedURLException, IOException { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpGet request = new HttpGet(urlString); HttpResponse response = httpClient.e

Re: [android-developers] JPG corrupted after save and load from external storage

2012-08-13 Thread user123
What do you mean exactly with original? I'm downloading it from the web, the image in the web has jpg extension. Maybe it's important, this is the code I instantiate the downloaded bitmap/drawable (which is later saved to the sd card) with: InputStream is = fetch(urlString);

Re: [android-developers] JPG corrupted after save and load from external storage

2012-08-13 Thread Harri Smått
On Aug 13, 2012, at 7:31 PM, user123 wrote: > What am I doing wrong? Thanks. This is a long shot but are you sure original image is JPG and not a PNG with alpha channel? Alpha could cause some unexpected behaviour once storing image as JPG. -- H -- You received this message because you are

[android-developers] JPG corrupted after save and load from external storage

2012-08-13 Thread user123
Hi, I have a jpg with a white background, and after saving and loading it to external storage, it's corrupted. Looks like: The code: Save: try { outStream = new FileOutputStream(file