Results 1 to 11 of 11
  1. #1
    zahariesergiu is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default Reading a part of image from a file

    Hello,
    It is possible to read only a (small) part of an image and then save it to a bufferedImage object?
    Last edited by zahariesergiu; 03-27-2011 at 08:29 AM.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by zahariesergiu View Post
    Hello,
    It is possible to read only a (small) part of an image and then save it to a bufferedImage object?
    Transform your Image to a BufferedImage and get the getSubimage( ... ) you want.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    zahariesergiu is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default

    Thank you for you quick response.. but i want to load full image, in small pieces at a time, to save memory!
    So it is possible to load only a part of an image?

  4. #4
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by zahariesergiu View Post
    Thank you for you quick response.. but i want to load full image, in small pieces at a time, to save memory!
    So it is possible to load only a part of an image?
    I don't think you can load part of an image from a file (or other external resource) with the supplied core classes.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  5. #5
    zahariesergiu is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default

    Hmm..ok.
    I have one more question:
    how to calculate the required memory for an bufferefImage to hold a picture?

  6. #6
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by zahariesergiu View Post
    Hmm..ok.
    I have one more question:
    how to calculate the required memory for an bufferefImage to hold a picture?
    A BufferedImage stores its image data in uncompressed form; depending on the type of the image it uses one, two or four bytes per pixel. Pluse a bit of overhead is needed so do your math ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  7. #7
    amitritika is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Default

    yes, when you want to read a small portion of an image you would have to convert it first into BufferedImage then you have to find out the position of pixels in that image and after that you should choose the pixels of particular position...
    if u r not able to write code ........tell me i will send u code for this

  8. #8
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,193
    Rep Power
    19

    Default

    Quote Originally Posted by amitritika View Post
    yes, when you want to read a small portion of an image you would have to convert it first into BufferedImage then you have to find out the position of pixels in that image and after that you should choose the pixels of particular position...
    if u r not able to write code ........tell me i will send u code for this
    Since you obviously haven't understood the question, it's hardly likely that you can provide any useful code.

    Also please read this page and don't post SMS drivel here again.

    db

  9. #9
    zahariesergiu is offline Member
    Join Date
    Mar 2011
    Posts
    5
    Rep Power
    0

    Default

    @amitritika ok, send me a code, maybe it will help.
    Thanks!

  10. #10
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,436
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by zahariesergiu View Post
    @amitritika ok, send me a code, maybe it will help.
    Thanks!
    Have you read this thread or are you just begging for code?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  11. #11
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    The built in image API's don't support this, but sure, it's *possible*, just really really hard.

Similar Threads

  1. Copy part of an image to another
    By Cain in forum AWT / Swing
    Replies: 2
    Last Post: 03-13-2011, 04:34 AM
  2. Reading in an image file
    By meestafa in forum New To Java
    Replies: 8
    Last Post: 11-17-2010, 05:11 PM
  3. Reading part of file with BufferedReader
    By mattgavin in forum New To Java
    Replies: 2
    Last Post: 11-13-2010, 02:44 AM
  4. Reading part of a line in a text file
    By aaronfsimons in forum New To Java
    Replies: 3
    Last Post: 05-04-2009, 07:57 AM
  5. Attachment referencing image part
    By jissondennis in forum Advanced Java
    Replies: 0
    Last Post: 03-16-2009, 06:56 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •