Blurry UIImage Problem

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

  1. steve1717 macrumors newbie

    Jul 18, 2007
    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

    Feb 16, 2007
    Waterloo, Ontario
    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

    Jul 18, 2007
    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

    Jul 18, 2007
    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

    Feb 27, 2006
    Kent, United Kingdom
    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