Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Light green background when saving image to file
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
user123  
View profile  
 More options Oct 2 2012, 3:31 am
From: user123 <ivanschu...@gmail.com>
Date: Tue, 2 Oct 2012 00:31:24 -0700 (PDT)
Local: Tues, Oct 2 2012 3:31 am
Subject: Light green background when saving image to file

I'm implementing an image cache for PNGs, downloaded from the web.

Works well so far, besides that on images with a transparent background,
get a light-green background, when they are read from the cache (external
storage).

Tested on 3 devices, the problem was in 2 of them, a Samsung Galaxy and HTC
desire. The third one, a Galaxy Nexus, has not this problem.

The relevant parts of code:

Save to file:

FileOutputStream outputStream = new FileOutputStream(fileUri);
image.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
outputStream.flush();
outputStream.close();

Read file:

File file = new File(fullCacheDir.toString(), fileName);

Download from web:

DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet request = new HttpGet(urlString);
HttpResponse response = httpClient.execute(request);
InputStream is = response.getEntity().getContent();

TypedValue typedValue = new TypedValue();
typedValue.density = TypedValue.DENSITY_DEFAULT;
Drawable drawable = Drawable.createFromResourceStream(null, typedValue, is,
"src");


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
user123  
View profile  
 More options Oct 2 2012, 3:57 am
From: user123 <ivanschu...@gmail.com>
Date: Tue, 2 Oct 2012 00:57:26 -0700 (PDT)
Local: Tues, Oct 2 2012 3:57 am
Subject: Re: Light green background when saving image to file

P.S: The original is not transparent, as I wrote. It's white.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »