I'm trying to save a jpg image but it's getting a bit blurred. I have it nicely in my image editor, but saving the image is not giving the quality I need, even with max quality defined.
If I save it as png, I get it with the sharpness I need.
Is there a way to overcome the loss of sharpness due to jpeg's compression? I really need it to be a jpg file.
You can check a sample of the image before and after here. As you can see, the orange is changing and the edges are not so sharp.
I start with a very high res jpg, change some colors, resize it, and save as jpg. If I save if first as png and then as jpg, still gets the same effect.
JPEG saves brightness (luminance) and color (chrominance) of the image in separate channels.
And JPEG has an option (used in your case) to save chrominance at half of resolution, since human eye is generally much less sensitive to changes of color hue than brightness.
So what you're seeing is "4:2:2" type of JPEG. To get perfectly sharp edges you need "4:4:4" JPEG that saves chrominance at full resolution.
Some programs automatically choose "4:4:4" variant when you set quality to more than 75%, so try exporting JPEG from a different program.
OR use PNG format, which preserves hard edges and will generally work better for such image with flat areas.
JPG is a lossy scheme. There will always be image degradation when saving as a jpg. If you started with a jpg, then save to a jpg things get even worse, fast.
If a jpg set on maximum quality is not yielding the results you wish, then chances are there is no solution other than to live with the quality you are getting if the image must be a jpg.
You might try saving as the png (which you state looks good) then open the PNG and save that as a jpg at max quality - might work... might not.