I have an image with a dpi of 600,600, but when i edit it, the dpi reduces to a very small value. How can I edit it without changing the dpi?
Purely digital images don't "have" dpi. They are just an array of pixels (dots). DPI1 - dots per inch - specify a way to translate the mathematical abstraction of pixels to a physical size. Only when you deal with physical rendering of the digital image - whether shown on a screen or printed on paper - does dpi become relevant.
The intrinsic property of a digital image is its pixel resolution: say, 900 x 450. The dpi setting is just a tag added somewhere to the image file. If dpi to this image says 300, it simply means that the image (or rather its author) wants the image to be rendered physically (e.g. printed) 3 x 1.5 inch. But you don't have to obey this instruction.
Changing dpi alone doesn't add or reduce information in the image. It just changes this instruction about physical rendering. It is an instant change without any processing of pixels. You could even remove it without actually damaging the image.
Cameras have no idea about the physical size of the output image the photographer has in mind. They set dpi pretty much arbitrarily. In contrast, flatbed scanners do know the physical size, and they meaningfully set dpi in the image they produce. In this latter case, the dpi setting conveys the information about the original size (as pixel dimension / dpi).
So, the thing that really matters in the digital world is how many pixels you have, and that's what you should pay attention to first. When you edit, does this number change? If it reduces (or changes at all) unintentionally, you should worry. Otherwise don't.
Any half-decent image editing software changes the dpi setting only when you request it to, and there is only one operation that does it: resize. Now, because there are two worlds involved - digital and physical - resizing may mean two different things, and this is why the operation may be called differently in different software packages.
- You can change physical size (which is, remember, just an instruction) without changing the pixel count. This is done by changing this dpi setting without "resampling" the image. When actually printed while obeying this instruction, the dpi setting first acquires its physical meaning: it defines how many image pixels are crammed in one linear inch. This is what is called "resolution" in the physical world.
- You can change the pixel count by resampling image. Here you will usually lose some information irreversibly - this is why you should worry doing that, and when doing, do it consciously. If you keep the dpi setting the same, the final physical output (again, when rendered following the dpi instruction) will change proportionally.
Of course, you can, and often want, a combination of these two things: you may want a certain dpi for a certain physical size. This will dictate how many pixels you need. This is usually an operation you do when preparing a physical output: most commonly a print.
Now, this is all a theory, but what happens in reality? In practice, whether for on-screen display or print, you start from a desired physical size: say, "full available screen" or "8 inch long". Then the software just resamples all available pixels to this size. As a result, you get "some" dpi of the original (= pixel count / physical size), and it rarely matches the dpi set in the image file. The image dpi is just ignored.
Furthermore, the otput device (the printer or screen) have their own resolution - i.e. dpi, and it is actually defined by their physical properties. If this real dpi is lower than what you've just got from the image, you have more pixels than necessary (for this particular output!), and you wasted some resources. In the opposite case, you don't have enough pixels, and you don't realise the best capabilities of your device.
Where does it leave us? Because the file dpi setting is ignored in nearly all cases (outside of some professional workflows, mostly for printing), some lesser software don't even bother to write it properly, and you may find it changed by just loading and re-saving the image. If this is the case (which you can verify by checking the pixel resolution), just ignore it as well. (Unless you have a requirement to have a certain dpi). This, however, tells you that the software you are using does suspicious and formally incorrect things, and you may consider changing it.
If, on the other hand, you resampled image, then double check what you are doing by checking the pixel count. Maybe you indeed requested to drop resolution and reduced your digital image while keeping the [prescribed] "physical" size.
1 Let's not complicate things by discussing PPI vs DPI.