Question

I am wondering if there is any way to compress a specific sections of an image and preserve other sections. For example I want the background of a large image compressed but the title and description text laid over the background to be crisp.

Was it helpful?

Solution

This would be pretty cool. Short answer (no).

Long Answer. JPEG and PNG. Do the background with JPEG and save this off as a separate file. Then do the title and description as a PNG with transparency.

In what every you are making (website, app) you will then be able to overlay these images and since the PNG has transparency it will appear as part of the original image.

At the end of the day we only have a few technologies we can work with ant that is jpg, gif, png, tiff, bmp, (svg some things dont support this) for image decoding for the end user.

Neither of these technologies do what you want well. PNG is awesome, but it the file size will be pretty huge compared to JPG. JPG wont give you crisp text when you have an image in the background.

I wouldnt be surprised if someone has written an encoder for what you want to do but being able to send this file to someone or something. They wont be able to decode it easily without your encoder and hence this is why we stick to the standard formats.

OTHER TIPS

The direct answers are:

If you are asking "can I . . . . in Photoshop", the answer to your question is NO.

If you are asking "can I . . . . programmatically," the answer to your question is YES, with some compression methods.

However, I sense there is a question behind your question.

You mention blurring. That suggests you are trying to save as JPEG because JPEG is the only major image compression technique that causes blurring.

The solution to this problem depends upon the nature of the image. Is it a photograph? Drawing? How many colors does it have?

Could you use another compression method (e.g., PNG as suggested previously)?

You might be able to get away with JPEG using a so called "high" quality setting at the cost of increased file size.

You can select to save it with a format that has lossless compression, but the compression rate is significantly lower. Having said that, save your file as JPG with the highest level (12), then open the new file and compare it to the original. In this level the details loss is relatively lower and if the text isn't on a single color background you might find this acceptable to your needs.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top