Add support for images that have a height or width of 0.*px

Check if the dimension is less than or equal to 0, not less than 1 as there are images that are 0.* pixels wide or high and they are still valid.