I need the file to be exactly 20K. When I save it as JPG, the smallest I can get it is 32K. When I save it to Web, the largest I can get it 2K...is there an in between or a way to save it exactly that I am missing?

  • The compression size will vary by pixel content: a 100px white square might be 400bytes, but the same square filled with noise might be 21 thousand bytes. GIF also has compression that depends on context (long runs of one color can be compressed quite easily). I am wondering why the odd requirement of precisely 20x1024 bytes.
    – Yorik
    Oct 27, 2015 at 18:24
  • Thank you for the feedback. It is a logo for a digital magazine...that is their requirement. Oct 27, 2015 at 20:53
  • With all possible different compression and downsampling algorithms, file size means exactly nothing. And thus it's a weird requirement for a "digital magazine". They must have some rationale to ask for this size; a minimum and maximum number of pixels is the most logical thing to ask for.
    – Jongware
    Oct 27, 2015 at 21:20
  • Maybe you misunderstood the requirement as being general for page-load budget rather than exact, or an upper size limit with the implication that you should not lose quality to make it unacceptably small. A jpeg might not be good for a logo anyway.
    – JDługosz
    Oct 28, 2015 at 0:10

1 Answer 1


Save it as a png first, to do the rastwrization and rendering. Then use software with full control to compress the png into a jpeg, and binary-search the compression values.

I would use ImageMagick for that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.