Blurry UIImage Problem

Discussion in 'Mac Programming' started by steve1717, May 12, 2008.

  1. steve1717 macrumors newbie

    Joined:
    Jul 18, 2007
    #1
    I am encountering an issue with the iPhone SDK where some UIImages show up as fuzzy/blurry and others do not. They are all created from .PNG files and I can't seem to isolate why some are blurry and others are not. At first I thought it was just smaller images (50 x 50px or less) but after some testing, I am not so sure any more. Has anyone run into this issue and/or know what I am running in to here? Thanks!:confused:
     
  2. lucasgladding macrumors 6502

    Joined:
    Feb 16, 2007
    Location:
    Waterloo, Ontario
    #2
    You may want to check the frames for the UIImages first. Frames are specified with float values rather than integers. If you have fractions, everything will seem blurry. If this is the case, use ceil(), floor(), or round() on the values before assigning the frame.

    This is my first guess, so don't spend too much time on it. That said, this has come up in my own apps once or twice.
     
  3. steve1717 thread starter macrumors newbie

    Joined:
    Jul 18, 2007
    #3
    Thanks for the tip. I performed quite a few different tests on that theory but ultimately the frame is determined by:

    0.0, 0.0, myImage.size.width, myImage.size.height

    Therefore, the sizes should be exact floats. Even when manually entering the sizes, I get the same blurry image.

    I've tried re-saving the culprit PNG's numerous times in all different sizes but I'm just getting erratic results.
     
  4. steve1717 thread starter macrumors newbie

    Joined:
    Jul 18, 2007
    #4
    Does this blurry UIImage issue occur just in the iPhone Simulator? I am hoping that this issue is confined to the simulator and does not actually appear while running on the iPhone.:confused:
     
  5. stadidas macrumors regular

    Joined:
    Feb 27, 2006
    Location:
    Kent, United Kingdom
    #5
    I just looked at the revision history for the UICatalog app on the iPhone Dev centre, and one of the update points was "fixed bad blur effect on UIView classes by properly rounding of coordinates". Maybe that is related to your issue?
     

Share This Page