java - What is the effect of storing a larger value in a grayscale png image? -


i trying perform dct on image block size 8x8 in java. after performing dct on first block, first value "372". after performing dct on entire image, wrote values png-grayscale image.values inside image automatically changed. grayscale image not store value greater 255. happen value greater 255 (for eg., 372) ?

you can not original image after loss of information need to:

  1. perform dct or ever
  2. find min,max values whole image
  3. change range pixel(x,y)=(255*(pixel(x,y)-min))/(max-min)
    • +/-1 or if clamp right range

after lose absolute values relative changes stays there

  • for purposes enough
  • if need restore original image
  • then need encode min,max values png somewhere
  • so add dummy scanline(s) , encode min,max first few pixels ...

restoration easy:

  1. read png image
  2. decode min,max
  3. restore original dynamic range pixel(x,y)=min+(((max-min)*pixel(x,y))/255)
    • +/-1 or if clamp right range
  4. perform idct or ever

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -