This content has been marked as final. Show 8 replies
I'm sure you'll find the answer to your question.I'm not. What exactly did you have in mind?
Unless I'm reading the docs wrong, getSubimage(...) returns a rectangular region of a BufferedImage as a BufferedImage.
Not what he asked for, is it? He wants to 'read only a (small) part of an image and then save it to a bufferedImage object'.
Well, the answer obviously is "Yes, you can do that." You can always read the first byte of a file and save it to an image or any portiion you may desire, but the question is: "Will it be meaningful?" Not really, unless you have some way of decyphering row/column info from your specific file format.1 person found this helpful
EJP wrote:That's a good question.
Not what he asked for, is it?
When I read '+part of an image+', I see that as wanting to read a selected area of an image. With that in mind, I go ahead with the thought that the OP already has the image read into an Image object of some kind, and would then like to read a selected area of that image. If the OP reads the image into a BufferedImage object, s/he can use the getSubimage() method to select the desired area of the image, which is then returned as a BufferedImage that can be saved off to disk.
Could that be an incorrect assumption? Sure, I'll admit that. The OP can tell me if I'm wrong or not, and we can go from there.
Either that, or I've misunderstood your emphasis...
morgalr can you explain how to do this?
or give me an example?
morgalr wrote:Please note that my anwer was--You can, but it would not be meaningful unless you have some way of decyphering row/column for your file format that you are using. I believe for most of the file formats, the answer there is--No, unless you want to reinvent a reader decypher partial lines of files for anything except a raw dump.
"Will it be meaningful?" Not really, unless you have some way of decyphering row/column info from your specific file format.
I believe you can always use the first part of the file, but then again, you may have to have some way of supressing the error coding and rejection process for the format decoders.