Closed cdeil closed 5 years ago
Actually it looks like the issue is just "JPEG encoding noise", if I change the example to larger integer numbers in the unit8
range (e.g. 0, 100, 200 instead of 0, 1, 2) they approximately round-trip.
https://nbviewer.jupyter.org/gist/cdeil/c5401336d7d5eb477263fb8b7b358de1
@cdeil - Thanks for looking into this.
Could this possibly have something to do with JPEG being a lossy format? We currently save the image using the Image.save function from Pillow, without providing any extra parameters for controlling the image quality.
This documentation for JPEG file format lists other keyword parameters that can be used e.g. dpi
and quality
(which is a number from 0 to 100, default is set to 75).
Maybe you could try setting this to 100 and see if it affects the output?
This is not changing any behaviour. It's just adding tests that prove that tile Numpy array conversions are working OK and doing some (accidentally applied) code formatting.
Today I wanted to make the
healpix_to_hips
work for RGB JPEG and RGBA PNG data. I'll make a pull request for that shortly.However, I noticed that there seems to be a bug in our
HipsTile.from_numpy
orHipsTile.to_numpy
for the RGB JPEG case. This PR shows the issue via a regression test. It works for FITS and also for RGBA PNG as expected.Looking for old issues I saw #112, possibly this is the same issue. I did try adding
.copy
calls before and after theflipud
calls infrom_numpy
, no change, so transposed Numpy arrays don't seem to be the issue.@tboch and maybe if you have time @adl1995 or @adonath - If you have time, could you please have a look at this and comment if you have any idea?
This is blocking the work on HEALPix -> HiPS and the v0.3 release, so we should try to figure this out ASAP.