could anyone please help me with this? I've created a design (for display on web and on mobile devices) and I need the pixel ratio to be let's say 500px by 500px, but the dpi to be 200dpi instead of 72dpi. The default in "Save for web" seems to be 72dpi and I can't seem to change it. At the moment, if I try to change the dpi in Illustrator or in Photoshop it automatically changes the pixel size instead of creating a higher dpi for the pixel size I need. The programmer I work with wants the pixel dimensions to remain 500x500 and the resolution to be 200dpi, how could I do that? Many thanks in advance!
dpi comes into play when printing. It stands for dots per inch. In your example, at 200 dpi and 500x500 pixels, the resulting image would print at 2.5x2.5 inches. (500/200 = 2.5)
When just saving a file (not printing) there are no physical dimension, just pixel dimensions. So dpi is not relevant without a physical dimension involved.
Use an external program, such as TweakPNG
But please bear in mind that web browsers quite deliberately ignore the DPI header (and assume 96DPI) because of the vast quantity of images in the wild with incorrect DPI headers. You'll also want to remember that the DPI header has no bearing on picture quality. It merely functions as a 'default zoom' when importing the image into various programs such as Office and Adobe.