This question is already partially answered: Write dpi metadata to a jpeg image in Java
From the image editor GIMP I know that .png has a resolution (DPI) one may save as meta data. There is EXIF data for JPEG, info of the camera in general, including resolution.