Jump to content

ektekmek

Newbies
  • Posts

    1
  • Joined

  • Last visited

ektekmek's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Thanks for your plugin, actually thanks for all of them! I have used your WebP plugin for a while and just stumbled on a need to explore JPEG2000 for another project. One thing I've noticed as I have gotten acquainted with pdn-jpeg-2000, though, is that, when saving a file, the slider is labeled "Quality" but maps to JasPer's "rate" (/100). For example, Quality 50 in the plugin currently maps to rate 0.50. I don't think this mapping works very well. Here's my reasoning: with standard JPEG, a regular user may not know what quality technically means, but from experience they learn that something in the 90's usually has few artifacts, 80's can be OK, and something below 50 or 60 is likely to look bad. The JPEG 2000 rate, though, appears to literally be the target file size for the .JP2 file, expressed as a percentage of the size of the uncompressed image. Say I take a test image that is 512x512 -- that is 768KB uncompressed (512*512*3 bytes). If I save it with pdn-jpeg-2000 "Quality" 25 (== rate 0.25), I'm going to get a JP2 file that's approximately 768KB * 0.25 = 192KB. If I save it with rate 0.10, I'll get a JP2 file that is approximately 76.8KB. Just multiplying the rate by 100 gives someone "Quality" numbers that are not aligned with the intuitive notion of regular JPEG quality at all. For example, with a copy of the infamous Lena.png image I tested with, everything pdn-jpeg-2000 Quality 57-99 results in what appears to be a byte-for-byte identical .jp2 file, roughly the size of the lossless version. "Quality" 12 (rate 0.12, or about an 8:1 compression ratio) is the first value that ends up with a .JP2 file smaller than a Q95 standard .JPG. Quality 12 in standard JPEG would be a disaster, but it appears to be a somewhat conservatively-encoded JP2. This just seems to be how JPEG 2000 and JasPer in particular works; it's not content-adaptive but very focused on hitting a certain bitrate / compression ratio. I can think of two potential alternatives to the current quality<->rate mapping: Change the slider to be "Rate" and assume the user knows what they're doing if they are saving JPEG2000 files. If you go this route, it might be more useful to specify the rate in the UI as the reciprocal compression ratio (i.e., 8:1 instead of 0.125) since most of the lossy rates between 0.75 and 0.99 are rarely even different, yet 0.01 is a pretty big change for compression rates between 0.01 and 0.10. Keep the Quality slider, but use the non-linear conversion formula ImageMagick used to use when they used JasPer (they have apparently since switched to OpenJPEG and I guess it's different now.) I looked it up in their v7 source code, and it is roughly Rate = 100/(115-Quality)^2 for lossy mode, with Q100 mapped to lossless. Personally I like the ImageMagick curve; working it out in Excel, the mapping goes like: Quality 95 = 4:1 (rate 0.25), Q90 = 6.25:1 (rate 0.16), Q85 = 9:1 (rate 0.111), Q75 = 16:1 (rate 0.0625), Q65 = 25:1 (rate 0.04), Q45 = 49:1 (rate 0.0204), Q15 = 100:1 (rate 0.01). A little conservative, perhaps, but reasonably intuitive if you are used to standard JPEG quality values. Also, what is a sensible default? The current default of 0.95 seems like it's rarely what someone would want, since it's usually the same size as lossless, but with the potential for minor errors. Maybe something between 8:1 and 12:1 is more appropriate since it's closer to a standard JPEG compression ratios?
×
×
  • Create New...