kevin-wayne / algs4

Algorithms, 4th edition textbook code and libraries
http://algs4.cs.princeton.edu/code/
GNU General Public License v3.0
7.42k stars 2.68k forks source link

Fix jpg image save #113

Closed arnabanimesh closed 2 years ago

arnabanimesh commented 2 years ago

fixes #111

kevin-wayne commented 2 years ago

Thanks! Looks like we introduced a bug in save() when adding support for Retina displays. The width and height in the JPG writing code should be 2width and 2height (instead of width and height). But I will incorporate your approach to ARGB-to-RGB conversion since it is simpler than current code with ColorModel. But, instead of scaling by 0.5 and making the saved image width-by-height, I'll avoid rescaling and make the saved image 2width-by-2height. That way, the resolution of the resulting image will be higher (and match the PNG dimensions).

arnabanimesh commented 2 years ago

closed 92dc4da7af2e467c325a7a2d94acd4aed21c95d8