4

When on travel.state.gov's photo editor, I get

Image is overly compressed. Please use a compression ratio that is less than 20:1

Is there anyway to get past this screen in the application given a jpg file? Can I open it up in a gimp and make less-compressed knowing the quality won't be better?

Evan Carroll
  • 9,518

2 Answers2

4

the tldr: in Chrome you open up the developer console (Ctrl + Shift + J) and run,

MAX_COMPRESSION_RATIO = Infinity

We can devise two ways to do this (1) by editing the image, or (2) by editing the JavaScript code.

How it works

Looking at the code, you can see how it's calculated from the definition of

function getCompressionRatio(e, t) {
    return 3 * e.naturalWidth * e.naturalHeight / t
}

And the call site,

var e = getCompressionRatio(image, imageNumBytes);

So in the definition e is image and t is imageNumBytes. This is the assumption that the raw image is 3 bytes-per-pixel (TrueColor).

function getCompressionRatio(image, imageNumBytes) {
    return 3 * image.naturalWidth * image.naturalHeight / imageNumBytes
}

Our options

  1. Editing the JavaScript code: Alternatively this error is rendered here,

    if (MAX_COMPRESSION_RATIO < e)
        setUI(UIModeEnum.INIT),
        setMessageDialog("Your photo has been rejected for the following reason(s):", [{
            description: "Image is overly compressed. Please use a compression ratio that is less than 20:1"
        }]),
        showControls(!0, ["divMessages"]);
    

    In Chrome you can open up the developer console (Ctrl + Shift + J) and run,

    MAX_COMPRESSION_RATIO = Infinity
    

    And then the conditional will never trigger and you won't get that error.

  2. Editing the image: In order to get a lower "compression ratio" for your image you need only lower the numerator ( 3 * image.naturalWidth * image.naturalHeight ) or raise the denominator by making imageNumBytes (image size) bigger.

Evan Carroll
  • 9,518
0

Evan Carroll I am so sorry that these people are such eggheads desparate to prove how smart they are. And actually do nothing to actually answer your question, pathetic.

I got the same message. Here is what I did to fix it:

  1. Open MS Paint
  2. Click resize
  3. Click Pixels
  4. increase the pixel count. I went from 600 to 800 then try uploading again and it worked perfectly for me. Good Luck!