File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Save an ImageView as a png file

 
R. La Com
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried posting this question earlier. I do not see it anywhere, so I am giving it another try.

I have been working on program (ReDrawa) to open an image (right now Colors.png, attached), change the color(s), and then save the changed image to the SDcard.


All goes well except for the saving. I have two methods that I have tried with some success.



This saves what I call an empty file. It does not show up in the Gallery. However, when I adb pull /sdcard/out0.png, it pulls out a file with no image (I cannot open the file) it is listed as having 0K.


The second method comes from code I saw on line that saves the R.drawable.icon. When I try to change it to R.id.imageView1 there is no error but again it is an empty file.



In DDMS there is a Null Pointer warning. So I am thinking that I have not connected imageView1 to bmp.

Thanks in advance for the help.


colors.png
[Thumbnail for colors.png]
 
Darrin Smith
Ranch Hand
Posts: 276
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To save it to the gallery (which is what I think you may really want to do).



If you really want to save it to the SD card, then this should walk you through it (note that a simple Google search provided this): http://android-er.blogspot.com/2010/07/save-file-to-sd-card.html
 
R. La Com
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your quick reply.

I think that I do want to save to the SD card. But I will certainly give your code a try.

I know about the code at the http://android-er.blogspot.com/2010/07/save-file-to-sd-card.html site. I have seen it
there and elsewhere in my web searches. I had discounted it being a guide for my project because, it loads an image
from the Internet using a URL. Whereas I am loading an image from a SD card (I added to my code an user input file
name). Also it saves the image using the URL (plus I suspected that it saved the web image rather than saving the
rendered image in my imageView).

I went to http://android-er.blogspot.com/2010/07/save-file-to-sd-card.html again and I tried cobbling its save code
into my project. I think I ended up with a hidious hybird. My attempt did not compile. I will put that aside until I try out
the code you suggest. My harddrive appears to be going wonky; it looks as tho I need a new one, so it may be awhile before
I can give it a go.

Thank You




 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic