Resizing images with higher DPI makes them dark

Discussion in 'Java' started by Manish, Mar 21, 2007.

  1. Manish

    Manish Guest

    I use following code to resize the uploaded images in our application.
    The resizing works fine, but I am getting darker images when I try to
    resize images with higher DPI.


    BufferedImageOp op = new
    AffineTransformOp(AffineTransform.getScaleInstance(mX, mY), new
    RenderingHints(RenderingHints.KEY_ANTIALIASING, Boolean.TRUE));
    BufferedImage bi = op.filter(img, null);


    These are my finidings -
    (1) When I upload a larger photo which is 72 dpi, the resizer works
    fine. for example, 1280px wide 72 dpi, will resize to 800 wid 72 dpi
    and the photo looks fine.
    (2) But if the original photo is 300dpi the resizer will convert it to
    800 wide 72dpi but the resized photo is VERY dark.

    I am wondering what could be causing this and how can I fix this
    problem. Any help, pointers wil be highly appreciated!

    TIA,
    - Manish
     
    Manish, Mar 21, 2007
    #1
    1. Advertising

  2. Manish

    Manish Guest

    Interestingly, when I resize photo on my local machine (Windows XP) -
    there is no darkening. But when we test this on our server - it is
    turing very dark (Linux box) - so I am wondering if there is any
    property/configuration that I can tweak to get this working?

    - Manish




    On Mar 21, 9:47 am, "Manish" <> wrote:
    > I use following code to resize the uploaded images in our application.
    > The resizing works fine, but I am getting darker images when I try to
    > resize images with higher DPI.
    >
    > BufferedImageOp op = new
    > AffineTransformOp(AffineTransform.getScaleInstance(mX, mY), new
    > RenderingHints(RenderingHints.KEY_ANTIALIASING, Boolean.TRUE));
    > BufferedImage bi = op.filter(img, null);
    >
    > These are my finidings -
    > (1) When I upload a larger photo which is 72 dpi, the resizer works
    > fine. for example, 1280px wide 72 dpi, will resize to 800 wid 72 dpi
    > and the photo looks fine.
    > (2) But if the original photo is 300dpi the resizer will convert it to
    > 800 wide 72dpi but the resized photo is VERY dark.
    >
    > I am wondering what could be causing this and how can I fix this
    > problem. Any help, pointers wil be highly appreciated!
    >
    > TIA,
    > - Manish
     
    Manish, Mar 21, 2007
    #2
    1. Advertising

  3. Manish

    Lew Guest

    Manish wrote:
    > Interestingly, when I resize photo on my local machine (Windows XP) -
    > there is no darkening. But when we test this on our server - it is
    > turing very dark (Linux box) - so I am wondering if there is any
    > property/configuration that I can tweak to get this working?
    >
    > On Mar 21, 9:47 am, "Manish" <> wrote:
    >> I use following code to resize the uploaded images in our application.
    >> The resizing works fine, but I am getting darker images when I try to
    >> resize images with higher DPI.
    >>
    >> BufferedImageOp op = new
    >> AffineTransformOp(AffineTransform.getScaleInstance(mX, mY), new
    >> RenderingHints(RenderingHints.KEY_ANTIALIASING, Boolean.TRUE));
    >> BufferedImage bi = op.filter(img, null);
    >>
    >> These are my finidings -
    >> (1) When I upload a larger photo which is 72 dpi, the resizer works
    >> fine. for example, 1280px wide 72 dpi, will resize to 800 wid 72 dpi
    >> and the photo looks fine.
    >> (2) But if the original photo is 300dpi the resizer will convert it to
    >> 800 wide 72dpi but the resized photo is VERY dark.
    >>
    >> I am wondering what could be causing this and how can I fix this
    >> problem. Any help, pointers wil be highly appreciated!


    A: It makes the posts hard to read.
    Q: Why is it bad?
    A: Placing the reply above the quote to which one is replying.
    Q: What is top-posting?

    -- Lew
     
    Lew, Mar 21, 2007
    #3
  4. Manish

    Manish Guest

    >
    > >> I am wondering what could be causing this and how can I fix this
    > >> problem. Any help, pointers wil be highly appreciated!

    >
    > A: It makes the posts hard to read.
    > Q: Why is it bad?
    > A: Placing the reply above the quote to which one is replying.
    > Q: What is top-posting?
    >
    > -- Lew


    Got it!! I will keep that in mind - I thought it makes it easier to
    read as the most latest is on top.
    Any useful inputs here?


    - Manish
     
    Manish, Mar 21, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RCS

    Higher DPI than 72

    RCS, Oct 19, 2003, in forum: Java
    Replies:
    6
    Views:
    2,894
  2. dwilson
    Replies:
    0
    Views:
    1,248
    dwilson
    Apr 8, 2005
  3. Replies:
    2
    Views:
    364
  4. Pil (Trustworthy from Experience)

    Resizing a div by resizing its borders

    Pil (Trustworthy from Experience), Apr 18, 2009, in forum: Javascript
    Replies:
    9
    Views:
    370
    Proper
    Apr 21, 2009
  5. Proper
    Replies:
    0
    Views:
    211
    Proper
    Apr 18, 2009
Loading...

Share This Page