Selective image compression? Forgive me if this is the wrong site for this question. Here's my problem: I am creating a game where players have to search for a hidden detail within the overall image. I downloaded an 11MB compressed photo from the internet which is 85MP in size (14000 x 6000 pixels). I had a very small image within this (a pixel-sized number). The color and brightness of this number closely matches the surrounding pixels so that it blends in. Now, when I went to save this image, the compression destroyed the hidden number, even at JPEG 12/Maximum. This maximum compressed JPEG increased the file size to 50MB even though the original was just 11MB. An uncompressed save file (TIF/PNG) reaches up to 250MB.

Is there anything I can do to compress the image while still preserving the integrity of the number? The number only encompasses a few pixels, but the addition of this small data has increased the file size 25x. I have access to Photoshop and Gimp. Thanks in advance, if you need to see the file then I can provide a link to it (at 250MB size or 50MB size).
To insert a JPEG image into another without recompression, you can use a jpegtran version with crop 'n' drop. It is safest to insert into coordinates that are multiples of the 16x16 pixel JPEG block size. On command line:

jpegtran.exe -drop +16+16 pixelated.jpg piano.jpg out.jpg


pixelated.jpg

piano.jpg

out.jpg

Difference images made in Gimp show only black, so there was no lossy recompression.

Difference image: piano.jpg vs. out.jpg

Difference image: pixelated.jpg (aligned) vs. out.jpg

Before all this, you can use

jpegtran -crop 


to copy the target region in the big image to a file for modification.

I wonder if jpegtran can handle your huge files. My test files were quite small.